lua-users home
lua-l archive

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


Adam escribió:

> I don't think that this is something particularly worth
> fighting for, especially if it complicates the nice slim parser
> at all.  They'll never realistically work exactly the same way 
> (a["ice-cream"]) so this is quite an acceptable restriction
> on what is simply syntactic sugar.

The patch is only six lines or so, and I suspect it will not
change the executable size at all if compiled with gcc or
some other compiler which inlines short functions. So the real
issue is whether it is a good idea or not.

One area where it comes up is code-generation, for example
writing tables out to persistent storage. As Adam says, you
cannot in general use a string in the sugared format, but the
test for whether you can, aside from reserved words, is a
simple pattern ([%a_][%a%d_]* for example). Putting a list
of reserved words in a persistence library is unsafe because
a future version of Lua might have more reserved words. So
the options are to always use the bulkier syntax, or a
library function lex.isreserved(str).

R.