lua-users home
lua-l archive

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

Hmm, I'm not sure what I think of reserved words in Lua.

which is syntactic sugar for

Apparently this only applies for identifiers, not reserved words, so that
is illegal, and NOT the same as

    x = {abc=5, break=6}
is an error, rather that the expected sequence
    x = {["abc"], ["break"]=6}

Now it is probably a good idea in most languages to outlaw redefining key
operational words (like "if" etc) when they appear in a statement context
but in Lua, which is heavily data & string based, areas which are described
as syntactic sugar for string constants seem an inappropriate place to rule
out certain words.

Lexically wise, one could simply defer the word->reserved-word conversion to
a later stage.

Thoughts anyone?

*Peter Hill*