lua-users home
lua-l archive

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




On 25/07/16 02:15 PM, Sergey Rozhenko wrote:
On Пн 25.07.16 23:45, Dirk Laurie wrote:
2016-07-25 18:28 GMT+02:00 Niccolo Medici <niccolomedici@gmail.com>:
On 7/25/16, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
The documentation for multiple assignment (section "3.3.3 –
Assignment" in the manual) doesn't mention the fact the assignment is
*not* carried out in order.
<snip>
BTW, is it guaranteed that the assignment order goes from RIGHT to
LEFT (I verified this in Lua 5.1, 5.2, 5.3, LuaJIT), or is it
"undefined behavior"?
It is not undefined behavior at all.
<snip>
It is like in C, which does not specify the order of evaluation of
expressions in argument lists in function calls.
You actually prove my point here.
...
You give two reasons.

First, you say "it's implementation detail". That's no reason to not
state that it's "unspecified behavior".

Second, you say "this allows us to change the implementation". Again:
that's no reason to not state that it's "unspecified behavior".
...
And that's wrong too.
I am not easily shocked, but this response by an OP to a reply by
a member of the Lua team is some of the worst trolling I have ever
seen on any mailing list.

That response isn't humble, but it's correct. That's not what's called 'trolling'.


You're right. However, the Lua manual is supposed to be terse, not a 200-page document.

Altho, anyone knows if this is well-defined?

local n = 0
local function nn()
  n = n + 1
  return n
end
local t = {}
t[nn()], t[nn()] = nn(), nn()

I'd expect it to work like

local temp1 = nn()
local temp2 = nn()
local temp3 = nn()
local temp4 = nn()
t[temp1], t[temp2] = temp3, temp4

--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.