lua-users home
lua-l archive

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


>From: Markus Ewald <Markus_Ewald@gmx.net>
>>
>> You have to keep in mind that getting and setting values in tables
>> may trigger tag methods and so an update operation like 'a.x += 57' really
>> is more complicated than it seems.
>
>Why am I having this deja vu feeling here ? :-)

You lost me here.

>Anyway, couldn't Lua just compile 'a.x += 57' as if 'a.x = a.x + 57' was
>written ?

It could, I guess. But it might give the wrong impression about what's is going
on. For instance, the following tag methods may be triggered but are hidden:
"gettable" to get the value of a.x, "add", settable to set the new value.

>Perhaps because there would still be no real '+=' operator ?

You mean, an '+=' opcode? If so, yes.

What I have said about this issue is mainly my own feelings.
I think that the rest of the Lua team have similar feelings, but we haven't
discussed this issue. I guess we will.

Also, += looks like C and we don't Lua to look like C (at least, we did not,
originally).
At least '--' is out of question, because it signals comments :-)
--lhf