lua-users home
lua-l archive

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

I'm probably beating a dead horse here, but…

- lua's multi-assignation does not interact very well with += and friends

Only when there are more expressions on the right-hand side than there
are variables on the left-hand. That would seem to indicate a logic
error anyway—is that an issue? I would expect x, y += 1 to do whatever
doing y + nil currently does…

- all these operators have in-place modification and atomicity semantics
  that do not go very well with lua either.  ':' is already more complex
  in that area than one would think at first glance.

Even using some mutable string object, I would expect buffer += "some
string" to change buffer. It has a plus sign, for concatenation, and
an equals sign, for assignment. If a statement with an equals sign
ever didn't assign, I would be worried. But maybe it's just me, and
for most people += is about mutation.

Is the only thing setting this apart from the colon the
multiple-assignment and mutation semantics? Neither are pure syntactic
sugar… isn't the same as, and += 1 isn't the same as = + 1.