[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua 5.2.0 (beta-rc1) now available
- From: Tony Finch <dot@...>
- Date: Wed, 15 Jun 2011 23:35:24 +0100
HyperHacker <hyperhacker@gmail.com> wrote:
>
> My vote would be for "label foo" or "foo::". The symmetry looks a bit
> ugly to me IMO and looks like it should be some kind of expression
> (e.g. |foo| is commonly written in text to mean math.abs(foo)), and !
> and & just seem confusing when they mean different things in other
> languages.
At the moment a Lua statement that starts with a variable name is always
an expression, which might be a function call or an lvalue part of an
assignment. Lua can parse and compile the expression without worrying
which form of statement it is part of. When it has dealt with the complete
expression it checks its form: if it is a function call then it is a
complete statement; otherwise it must be assignable and followed by a
comma or equals.
Therefore the contenders for label syntax all have a disambiguating token
before the label name so that it cannot be confused with an expression.
Without that Lua's parser would have to undo a partly constructed
assignment expression when it sees the :: marker.
Given the constraints of the parser I prefer @label or ::label without
trailing punctuation. (If you want a terminator you can add one or more
semicolons.)
Tony.
--
f.anthony.n.finch <dot@dotat.at> http://dotat.at/
Malin, Hebrides: Southerly 5 or 6, occasionally 4 in east. Moderate or rough.
Showers. Moderate or good.
- References:
- [ANN] Lua 5.2.0 (beta-rc1) now available, Luiz Henrique de Figueiredo
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, Alexandre Erwin Ittner
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, Frank Meier-Dörnberg
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, David Kastrup
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, Frank Meier-Dörnberg
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, Eduardo Ochs
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, Frank Meier-Dörnberg
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, David Given
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, Roberto Ierusalimschy
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, phlnc8
- Re: [ANN] Lua 5.2.0 (beta-rc1) now available, HyperHacker