lua-users home
lua-l archive

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


> > When steve donovan proposed a "const" keyword earlier today, I wondered if
> > LuaJIT was able to spot that a local is only assigned to once so it could
> > automatically treat it as const.
> 
> It would be more in the spirit of Lua (that abused term) if the
> constness of a value could be deduced from its usage like this.

In the lua.org VM locals and constants are equally fast, being lookups
into an array. (I'm ignoring locality of access issues.)