lua-users home
lua-l archive

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


spir wrote:
> 
> It is another issue: one cannot distinguish between assignments
> *intended* to create a new or change an existing variable. (see also
> http://spir.wikidot.com/create-vs-change, esp. section "things &
> qualities")
> 

Right. Lua aims for simplicity by only providing one interpretation of
the '=' operator: assign an existing value to a variable. It's the
right-hand side of the expression that does all the object creating. The
left-hand side is only binding the value to a key in a table. And local
variables are keys in a "table" that gets optimized away by the compiler.

As for "creating" variables, there is no such thing. All possible
variable names exist by default and are assigned the value 'nil'.

The upshot of all this is that values live independently of variables.

In-place operators look sexy as syntax, but does it make a difference to
the VM? I'm not sure it does.

-- tom
telliamed@whoopdedo.org