lua-users home
lua-l archive

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


+1 for <keyword> <id> ...using "label", "jumplocation", or whatever else people can think up as keyword.

IMHO on purpose creating syntactically ugly constructs to demote the use of them and make them stand out is somewhat corrupting the language, and making a language clean and natural is worth a lot in my eyes. Adding constructs like &name: is just confusing to me. Of the alternatives mentioned in the list ::label:: seems the least obtrusive to me but it still strikes me as artificial.

I don't know what's required to enter this discussion but I thought I'd just give opinion since I've become a keen Lua user. 

Kind regards,
Fredrik Widlund

________________________________________
Från: lua-l-bounces@lists.lua.org [lua-l-bounces@lists.lua.org] f&#246;r Petri Häkkinen [petrih3@gmail.com]
Skickat: den 17 juni 2011 08:31
Till: Lua mailing list
Ämne: Re: [ANN] Lua 5.2.0 (beta-rc1) now available

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