[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: What would you remove from Lua - a case of regression?
- From: Coda Highland <chighland@...>
- Date: Mon, 26 Nov 2018 16:22:09 -0600
On Mon, Nov 26, 2018 at 1:33 PM Dibyendu Majumdar
> 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?
This still doesn't help with the number typing, but for that you could
consider using a polymorphic approach, emitting multiple variations of
a function based on the function parameter types and dispatching to
them at call or JIT time based on the known types of the parameters.
LuaJIT does something similar to this. The checks do imply a small
performance hit if you can't statically determine the types at compile
time, but it's probably less of a hit than checking for every