lua-users home
lua-l archive

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


On Mon, 26 Nov 2018 at 22:22, Coda Highland <chighland@gmail.com> wrote:
>
> On Mon, Nov 26, 2018 at 1:33 PM Dibyendu Majumdar
> <mobile@majumdar.org.uk> wrote:
> > I think it would be nice to have two VMs built-in - a full featured
> > one and a cut-down one, with user being able to choose the one they
> > want to use. But it is harder to switch between dual number type to a
> > single number type.
>
> Have you considered doing the work at a different level? One common
> bytecode format, one common VM, two parsers? Or possibly even a
> source-to-source transpiler that compiles full-Lua down to mini-Lua?
>

Hi, that would not solve the problem as the problem I am trying to
solve is to have simpler code to execute with less unpredictable
branches. A common VM would have to handle the worst case. However
what I could do is fall back to the full featured VM when a type check
fails. This would cause a small performance hit for Lua code that
relies upon the bigger feature set, but in theory this cost can be
minimized by black listing the function so that next time it goes
immediately to the fallback VM.

Regards