lua-users home
lua-l archive

Re: Ternary operator patch

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Wed, Sep 15, 2010 at 8:41 AM, David Kastrup <dak@gnu.org> wrote:
> While this more or less tells us that Lua is indeed a mess, it does not
> tell us what the above input will give.  "Lua would see that" does not
> suggest that Lua would actually throw an error.  Indeed, "Lua would see
> that" suggests that _if_ you want to have Lua see that as a single
> statement, writing it like that should work, on contradiction to the
> last sentence of the quote (which turns out more correct).
I'm not sure I understand what you're saying, but there's no reason to
throw an error at all, and I don't see the manual as
self-contradicting (maybe a little confusing).
The whole point the manual is trying to make is that both
 a = f(g).x(a) -- [A] meaning "a = (f(g).x(a))"
 a = f; (g).x(a) -- [B]
are valid (different) expressions, and without the "no line break
before `(' for function call" rule, the following two lines:
 a = f
 (g).x(a)
would be *apparently* [B] (to a human user), but would actually be
"seen" by Lua as [A] (because line breaks are usually ignored by the
parser).
- Ricardo

AltStyle によって変換されたページ (->オリジナル) /