lua-users home
lua-l archive

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

> But the "+="(or "+") operator can be quite ambigious
> in the context of table, even for just default
> behaviour.
> t={1,2,3,4}
> d={5,6,7,8}
> t += d

It's no more ambiguous than
t = t + d
which is what it would/should be shorthand syntactic sugar for.

We already have an __add metamethod, we wouldn't want (IMO) a different
__addassign metamethod.

I too have wanted +=, but at the same time I am repeatedly wowed by the
speed and small size of Lua's interpretter. As I understand it,
simplicity is why += isn't in there; do we really want to start adding
in lots of features if the result is a slower, more bloated Lua? (Death
by a thousand paper cuts is still death.)