9 ms·
Lua is a language I really want to love. I like the emphasis on simplicity and minimalism, and the Scheme-like semantics, which mix imperative and functional st
by gautamcgoel 6y ago
Lua is a language I really want to love. I like the emphasis on simplicity and minimalism, and the Scheme-like semantics, which mix imperative and functional styles, really hits a sweet spot IMO. LuaJIT is a crazy impressive feat of software engineering. However, there are some specific issues which hold Lua back IMO. First, as LuaJIT author Mike Pall famously noted, the Lua authors constantly break compatibility between releases. Lua is really several different, incompatible languages (Lua 5.1, 5.2, etc). LuaJIT is still at Lua 5.1, IIRC. Second, there are a bunch of minor nitpicks (1-based-indexing, anyone?) which turn off a bunch of people. Lastly, because Lua is so minimal and focused on portability, people end up reimplementing their own abstractions (such as object systems) from scratch, further fracturing the ecosystem. I think there's a space for a new project, which takes LuaJIT as a starting point and addresses some of the issues I described. It would also be great if this hypothetical new language had better support for Unicode and concurrency.
- ebg13 6y ago> LuaJIT is still at Lua 5.1, IIRC It's 5.1 plus some of 5.2.
- bch 6y agoIf you’re not already familiar, check out Tcl. It’s well established, similar domain, and addresses some of your concerns head-on - very stable API/semantics, not 1-based, comes with quite a few “batteries” included, excellent concurrency and parallelism (lovely thread model (apartment [0])), native Unicode... but still portable and actively developed. [0] http://www.opengroup.org/comsource/techref2/CHP06GDC.HTM http://www.opengroup.org/comsource/techref2/CHP06GDC.HTM
- google234123 6y agoTcl code always looked ugly to me
- the_hoser 6y agoTCL is... semantically, amazing. It is syntactically hideous. As much as we like to claim that we're technical people and form over function blah blah blah... aesthetics and readability matter.
- virtue3 6y agoone of my professors described TCL as "what a bunch of grad students made for a programming language". Always got a chuckle out of me.
- the_hoser 6y agoPretty close. It was a professor that was tired of people writing languages to embed in their applications, so he wrote a language to embed in applications. Very much an XKCD 927 story.
- bch 6y agoThe guy who also brought us raft[0], log structured file systems[1], and Ousterhouts Dichotomy[2], among other things, in case you were thinking “not a bunch of grad students, but ‘some professor’.” [0] https://en.wikipedia.org/wiki/Raft_(computer_science) https://en.wikipedia.org/wiki/Raft_(computer_science) [1] https://en.wikipedia.org/wiki/Log-structured_file_system https://en.wikipedia.org/wiki/Log-structured_file_system [2] https://en.wikipedia.org/wiki/Ousterhout's_dichotomy https://en.wikipedia.org/wiki/Ousterhout's_dichotomy
- the_hoser 6y agoI figured that details like that didn't matter in the context of the joke. He was a smart and productive person that designed an ugly programming language.
- petre 6y agoIt's also quite slow.
- pansa2 6y ago> I think there's a space for a new project, which takes LuaJIT as a starting point Unfortunately, LuaJIT is tightly-coupled to the Lua language and its code is very complex. I'd be surprised if anyone other than Mike Pall was able to retarget it to support a different language. Also, is JIT compilation really necessary for a scripting language? Projects like the PyPy JIT for Python have seen little adoption, and many platforms (e.g. iOS and game consoles) don't support JIT at all.
- jashmatthews 6y agoCompared to other JIT compilers LuaJIT is very simple. Thomas Schilling forked LuaJIT to run Haskell with what looked like some good results http://files.catwell.info/misc/mirror/tracing-jit-haskell-schilling.pdf http://files.catwell.info/misc/mirror/tracing-jit-haskell-sc...
- Rochus 6y ago> Compared to other JIT compilers LuaJIT is very simple. Wow, the understatement of the year.
- Rochus 6y ago> I'd be surprised if anyone other than Mike Pall was able to retarget it to support a different language. Not that difficult. See e.g. https://github.com/rochus-keller/Oberon#lua-source-and-bytecode-generator-features https://github.com/rochus-keller/Oberon#lua-source-and-bytec..., https://github.com/rochus-keller/Smalltalk#a-smalltalk-80-interpreted-virtual-machine-on-luajit https://github.com/rochus-keller/Smalltalk#a-smalltalk-80-in..., or here a whole list of other language frontends: https://github.com/hengestone/lua-languages https://github.com/hengestone/lua-languages
- pansa2 6y agoSorry, that's not quite what I had in mind. I was considering the feasibility of modifying LuaJIT to directly target a different language. The projects you link to all either compile to, or are written in, Lua source code or LuaJIT bytecode. That's less efficient than retargeting the LuaJIT VM. For example, LuaJIT includes bytecode instructions specifically tailored to Lua tables. It looks like these projects build, say, their array data structures on top of those existing instructions, rather than adding array-specific support to LuaJIT.
- Sophistifunk 6y agoWhat you're looking for is the JVM.
- sriku 6y agoJulia also has 1-based indexing .. You get used to it pretty quickly.
- markrages 6y agoYes, you just crap up your code by subtracting 1 anywhere you need to calculate an index. I moved from Matlab to Python and the biggest improvement was zero-based indexes.
- pjmlp 6y agoJust like you do with the upper index in zero-based languages , as length > max index. Apparently this little detail is never taken into account.
- Reelin 6y ago> You get used to it pretty quickly. You don't if you're writing low level algorithms. It's difficult for me to articulate the exact problem but I liked 1-based indexing until I needed to implement some algorithms that operated on multi-dimensional arrays element wise. Things just don't compose the right way. It's actually the primary reason I don't make more use of Julia. I like the syntax and overall design more than Python but it just isn't worth it to me. (If you're wondering what I'm doing in an Lua comments section, it's because I really like the ideas behind some of the Lua based languages such as Terra.)
- henrikeh 6y agoI primarily work in 1-indexed languages, but I think everyone is missing the forest from the trees in this discussion: indexing should be selectable by the programmer. One or zero indexing is a question about domain and communication. In signal processing, it is quite normal to need a negative index (autocorrelations f.x.). Ada (and I believe Pascal and Julia) has supported for specifying the indexing type, which can then be selected to match the problem domain.
- google234123 6y ago
- jhoechtl 6y agoYou have all my upvotes. I really would like to like Lua but the lack of the mentioned basic infrastructure elements like powerful Unicode support and platform-independent parallelism abstractions make every larger Lua project a DSL of it's own.
- anonymoushn 6y agoIn Openresty you don't end up facing much trouble around parallelism. In other contexts, I might go for love2d's thread module, which can be loaded from liblove on its own https://love2d.org/wiki/love.thread https://love2d.org/wiki/love.thread I've had an ok using unicode libraries but I haven't had to do much with them so far.