lua-users home
lua-l archive

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


On Thur, Jan 5, 2012 at 12:21 PM Patrick Donnelly wrote:
What you are doing is actually defined in the manual.
[1] http://www.lua.org/manual/5.1/manual.html#2.4.3

Not quite, here multiple assignments shows an interesting undocumented side effect:

   local a = {};
   a[1], a = (function() a = nil end)()

Executes fine.

Where as without the extra assignment to 'a':

   local a = {};
   a[1] = (function() a = nil end)()

Crashes with error: assignment to nil.

Now the second could be made to behave like the first if the first is intended behaviour, which I believe it is (w/w the special handling Lua has for conflict detection preventing the first from throwing an error).

So I'm still left wondering: bug to be fixed, implementation defined corner-case or current implementation is expected - with this specific scenario left undocumented.

Sorry if it seems like fussing over something that'd hopefully never occur in the wild: in my spare time as a learning experience I'm making my own compiler to MSIL (I am aware this has been done before), making this something I need (or want, rather) to consider...