[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: SV: Excessive expressions in assignment (was: Garbage Collector)
- From: "Andreas Stenius" <andreas.stenius@...>
- Date: Mon, 15 Dec 2003 09:49:33 +0100
Edgar Toering wrote:
> Reuben Thomas wrote:
> >
> > > local x = 10, y
> >
> > This is incorrect syntax. You meant
> >
> > local x, y = 10
>
> The problem is that it *is* correct syntax but
> most probably not what one wants. If one comes
> from C/C++ it's easy to make this error and Lua
> accepts it silently.
>
> Therefore the question: Should Lua issue an error
> for this condition, fewer names on the left hand
> side than expressions on the right hand side?
> It normally makes no sense to explicitly supply
> excessive expressions.
The problem is when the assignment is from a function
call, and you don't want (need) all values returned.
I would recommend people from the C-world to make a
clean start when learning lua. If it's hard, keep it
simple at first with 1 expression / line.
//Andreas