lua-users home
lua-l archive

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




2011/6/14 Lorenzo Donati <lorenzodonatibz@interfree.it>
On 13/06/2011 23.26, Lorenzo Donati wrote:
On 13/06/2011 21.52, Roberto Ierusalimschy wrote:
Due to the introduction of labels, '@' can now appear as the first
character in a valid Lua chunk. This means that the following passage
from lua_Debug is incorrect: "If source starts with a '@', it means
that the function was defined in a file where the file name follows
the '@'. If source starts with a '=', the rest of it should describe
the source in a user-dependent manner. Otherwise, the function was
defined in a string where source is that string."

We thought about that. At the time, it seemed that users could simply
avoid starting a chunk with a label (a simple space, newline, or a
comment would be enough). But now that thought seems feeble. The two
obvious solutions would be to change the character that marks filenames
or the character that starts labels. The second option has the slight
advantage of not creating a small incompatibility. Suggestions?

-- Roberto



Mmm, IMHO better to change the syntax for label.
BTW they look a bit ugly as they are now (but maybe this is intended :-)

If the start character must be something unused in Lua, there are few
alternatives among ASCII: #, $, |, &, ?, !, `.

Sorry for replying to myself. Of course # is not _unused_ in Lua.

I'd better stop replying to the mailing list late at night! :-)

(Probably my by brain was impressed too much by the eternal discussion about the meaning of # for arrays with holes and wanted to give a new twist to that game :-P :-)


And you will find in Lua 5.2 beta, the meaning of # operator is changed.