[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua Short Reference, minor upgrade
- From: Thomas Lauer <thomas.lauer@...>
- Date: Thu, 02 Jul 2009 16:26:57 +0100
Duncan Cross <duncan.cross@gmail.com> wrote:
> On Thu, Jul 2, 2009 at 2:10 PM, Thomas Lauer<thomas.lauer@virgin.net> wrote:
> >> - Potential for confusion, maybe:
> >>
> >> x:move (2, -3)
> >> object call: shortcut for x.move(x, 2, -3), x will be assigned to self
> >>
> >> ..."x will be assigned to self", only if x.move was also created using the
> >> same syntax. Someone could misread this as 'whatever parameter was named
> >> "self", wherever it appears in the parameter list, will be set to x'.
> >
> > What wording would you propose instead? Perhaps removing the "x will be
> > assigned to self" altogether?
>
> I think so. I'd also specify in the "Function definition" section that self is
> an extra *first* argument. (The reason I think that it is useful to
> deconstruct the syntactic sugar a little bit here is that sometimes I want to
> define a function inside a {} table literal, and of course in that situation
> you have to add the "self" parameter explicitly.)
I've removed that bit and added "additional first argument self" with
the object function definition.
(A short ref can never be as complete and accurate as the original. This
exercise is a little like repeatedly trying to compress a compressed
file, until you end up with a file of just 1 byte length: my less
IT-literate friends still find the impossibility of doing this puzzling
-- "hey, just zip the zip!".)
> > setfenv: the manual says "As a special case, when f is 0 setfenv changes
> > the environment of the running thread. In this case, setfenv returns no
> > values." So I'll leave it as it is.
>
> True, I had forgotten about this extra complication.
As there was just enough space I have now added both cases;-)
> Some additional notes:
> - Multi-line strings: One thing that is easy to forget is that if it starts
> immediately with a new line, that new line is removed. (You also don't
> mention the variable number of =s, but you do for multi-line comments,
> maybe this is deliberate.)
It is deliberate in the sense that adding it would wreak havoc with the
table formatting.
> - Decimal escape sequence can have one or two digits instead of three, again
> not mentioning this might be deliberate.
Added.
> - Very minor: "nil" not bolded in coroutine.running()
Changed.
> - The __len metamethod is (currently) only used by userdata.
Added.
And thanks again. Anything else?
--
cheers thomasl
web: http://thomaslauer.com/start