lua-users home
lua-l archive

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


On 6/15/2015 9:26 PM, Jinhua Luo wrote:
Maybe the reference should describe more: "local" should be used
once to declare new local variable (with different variable name).
After all, the max number of local variables is limited due to the
opcode format.

It's an interpreted implementation of a programming language. There are bits of 'inefficiencies' here and there, but the effects are minimal. A trade-off, if you will -- clarity versus complexity.

If one writes benchmarks, of course it's possible to maximize minor things. But most users would be writing sane code and will do fine.

That said, there are plenty of optimizations that can be implemented. Then you'd need a lot of new debug info and code... Anyone know of any [interpreter] implementations that focuses on optimizations? (Apart from the usual JIT suspects like LuaJIT and Ravi, that is.)

2015-06-15 21:03 GMT+08:00 Luiz Henrique de Figueiredo:

    > So why the parser do not recognize this case and keep only one variable instance?

    For all pratical purposes, it does not matter: the program
    will have the
    same behavior regardless.

    So, why complicate the parser?

--
Cheers,
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia