lua-users home
lua-l archive

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

On Wed, Jun 15, 2011 at 8:29 PM, Roberto Ierusalimschy wrote:
Some real contenders:

1) keep all as it is
2) change the indication of filenames in debug info and in LUA_INIT
3) ::label::
4) |name|
5) &name:
6) !name:
 Like others I think the syntax for labels should be "::label::"

- it fixes the issue with chunk source name declarations
- it looks aesthetically like a label
- |label| would be a bit confusing because it looks like a mathematical notation

To me '@' looks like something not part of the core language, and something that should be reserved for future use. For example, '@' could perhaps be used for a general class of C preprocessor like directives. I'm thinking along the lines of "@source chunk-name-goes-here", "@line 123", or even "@def mymacro(x,y,z) ..." The usage of '@' as chunk name declarator in 5.1.4 already leans in this direction.

Adding a new keyword "label" (not on Roberto's list) would be very Lua-like and was my first reaction too, but I don't think adding such a generic keyword for a relatively rarely used language feature is wise. Most (if not all) keywords in Lua are used frequently in code but gotos and labels would be more rare. On the other hand, "goto" as a keyword is fine, because it is commonly used elsewhere and it's unlikely that it would make anyone unhappy because people have most likely anticipated the addition of "goto" keyword for some time.

The bottom line is "::label::" fixes an issue and leaves '@' free to be used later, so it's a better choice than "@label:"

Best Regards,

Petri Häkkinen