lua-users home
lua-l archive

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



--- Gavin Kistner <gavin.kistner@anark.com> wrote:

> > 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.
That is why I think "+" is not the right operator at
all, at least not for "add this to tail". Having
program in python as well, at least I can get similar
behaviour if it is just an extend.

> 
> 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.)
> 
My thought too. It is just not worth it when there is
already insert which serve the purpose, and the
t[#t+1] which make things a bit faster(may be even
more clear of what it does) should it be needed. 



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com