lua-users home
lua-l archive

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


It was thus said that the Great Thiago L. once stated:
> The Lua VM is too big. I have an idea of how to make it smaller, with 2 
> breaking changes and 2 backwards-compatible changes:
> 
> Breaking changes:
> 1. Remove OP_ADD (use `-(-x-y)` instead) [breaks/removes `__add` metamethod]
> 2. Remove OP_MUL (use `x/(1/y)` instead) [breaks/removes `__mul` metamethod]

  Still too many left.  

http://en.wikipedia.org/wiki/One_instruction_set_computer#Instruction_types

> Compatible changes:
> 1. Turn for loops into syntax sugar, remove OP_FORPRER and OP_FORLOOP 
> (which can be used to break out of sandboxes), OP_TFORLOOP (the opcode 
> for `for ... in ...`) [1]

  How can you escape from a sandbox using OP_FORLOOP?

  -spc