1. 13
    1. 17

      I wrote Lua, a misunderstood language years ago, and it is still amuses me that people try to make Lua into something it kinda doesn’t want to be.

    2. 15

      adds more than a dozen highly-desired syntaxes such as switch statements, compound operators, classes, class inheritance, string interpolation, type hinting, enums, and so on.

      Amazing how that is almost entirely things I don’t want in Lua. String interpolation is nice, but every other addition feels like it moves away from Lua’s simplicity for some mild convenience.

      1. 10

        Not having classes is one of Lua’s best features.

        1. 3

          Not just classes, but “class inheritance”! Cracked me up when I read that.

    3. 4

      This is really interesting. Are the optimizations specific to the semantics of Pluto or could they be implemented in any lua compiler? The “for loop” optimization doesn’t give any detail as to what it actually is, but a 3.5x speedup (on what I assume are trivial loops) is pretty significant.

      EDIT: Here is the commit https://github.com/PlutoLang/Pluto/commit/e9e7f24457a4f8dc66a60ed8f71da1d075e79567

      I don’t understand how Lua works well enough to confidently say what is is doing, but it looks like it is using a spare slot in pairs and ipairs to hide an index. That index is used in the loop body find the first empty slot faster. So it seems like it is passing information between the setup and loop body. I wonder why you couldn’t just use a global variable?

      1. 2

        Also looked into the jump table optimization. The normal lua version is here and it uses the opcode as a index into a static array to jump to the label. The “faster” pluto version is here and it just uses a switch statement on the labels. I would naively assume that these would compile to the same code because the lua version is just manually creating the jump table and the pluto version is leaving it to the compiler. How could the compiler optimize the switch so that would outperform the manual jump table (by a decent margin)?

    4. 4

      Honestly, Tcl is the “modern Lua” people want.

      1. 2

        Why tcl? Also it’s a lot older I believe.

        1. 1

          Because it has batteries included; a full standard library unlike Lua. However, it’s still lightweight and embeddable.

    5. 3

      This reminds me very much of Luau without the backwards compatibility with 5.1.

    6. 1

      MoonScript was another similar attempt.

      1. 2

        MoonScript (written in Lua, compiles to Lua) and its offshoot Yuescript are the main contenders it seems for a “lighter” Lua a là CoffeeScript to JS. And then @technomancy’s Fennel, the Lisp of the bunch. But only Yuescript is actually a rewrite (in C++17) like Pluto is (also C++17).

        1. 1

          YueScript has been my favorite language for a long time.

          Not the most practical, but the most fun by far.