lua-users home
lua-l archive

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

Roberto Ierusalimschy wrote:
> This time, however, we would like feedback about the syntax for labels,
> because of the small incompatibility of the '@' with filenames.

Simply prepend a space in case the chunkname derived from a string
starts with a '@'. You only need to change luaL_loadstring and
luaB_load. Problem solved.

If a user explicitly supplies a chunkname that starts with a '@',
they ought to know what they are doing (e.g. if the source code
originates from a file).

Actually a related usability problem is that few users provide an
explicit chunkname to loadstring() (in 5.1) or load() (in 5.2). So
the chunkname is set equal to the original string and is attached
to each function prototype. This keeps the string alive and may
occupy a lot of memory. And the complete original source code will
end up in a bytecode dump, too!

OTOH for tracebacks etc. only a shortened version is shown. Few
users realize where the memory hog comes from or why their
bytecode dumps take up so much space.