Re: Turning Lua into C++ (was: alleviate the load of the GC)

  • From: Tudor Bosman <tudorb@xxxxxxxxx>
  • To: "luajit@xxxxxxxxxxxxx" <luajit@xxxxxxxxxxxxx>
  • Date: Wed, 2 Sep 2015 07:58:45 -0700

I don't think anyone wants to turn Lua into C++; they want to turn Lua into
Javascript :)

Personally, the thing I like about Lua is that the language grammar fits
comfortably on half a page. It's a simple language, yet powerful (mainly
because closures work the way the gods of Lisp intended). Don't change that.

I'd add only one thing -- differentiating between initialization and
assignment. Which means that "a = 2" should error if a can't be found in
scope rather than creating a new global variable; I'd suggest "global a =
2" for that.

There are other language warts (nil === undefined means that typos are
difficult to catch; varargs and select() are ugly; even with the __eq
metamethod, you still can't use tables as table keys the way you'd want to;
etc) but all languages have warts; trying to create the perfect language
will never work.

I'm all for extending the standard library, though; you can do much worse
than imitating the Python standard library and cherry-picking good stuff
from Penlight.

-Tudor.

Other related posts: