lua-users home
lua-l archive

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

On Fri, Nov 18, 2011 at 11:14 PM, Axel Kittenberger <> wrote:
> JS to Lua is just as tricky. As similar the languages have evolved
> (convergent evolution) they are different enough that they cannot be
> easily translated in each other, at least not without a large
> compatibility/emulation layer.

I don't think it'll trickier than translating Perl 5 to Perl 6 ;)

> In Lua 5.1 I would have said,
> impossible since continue not supported by Lua, with 5.2 they got a
> workaround at least. Its still tricky tough.

Why should we do a strict literal translation here? The assembly
language does not support "continue" but it does not prevent a C
compiler to translate C code to it ;)

> How do you properly
> emulate JS undefined/null destinction?

Userdata, for example? ;)

> On Arrays with holes one can
> construct cases where JS even distinguishes "not there", "undefined"
> and "null" :-)

We surely cannot use Lua tables as JavaScript arrays directly here.
Some kind of emulation must be done here for a proper JavaScript
compiler implementation :)

It's a nontrivial project for sure. But we do have good JavaScript
test suites out there ;)