1. 37
  1.  

  2. 8

    In the footnotes:

    There is a bit of awkwardness around ambiguity between array-like tables and key/value tables, but it is not nearly as awkward as using alists.

    I appreciate Lua’s single data-structure to rule them all, but also believe that a language can support more than 1 core data structure without sacrificing simplicity. As such, I’m kind of surprised that Clojure is the only mainstream Lisp to ever be successful providing actual syntax for an associative data type.

    It also piques my curiosity as to whether or not an efficient deque implementation instead of cons cells makes more sense as a core data structure in a Lisp…

    1. 7

      Some complexity appears in Lua because the language blurs between ordered and unordered/sparse collections, so code needs to explicitly distinguish between them at runtime. (For example, ipairs vs. pairs.) People can create Array or Map constructors that bake that knowledge in with a metatable, but the language explicitly avoids endorsing any conventions for it.

      There’s a lot I like about Lua, but having something like [] vs. {} for collection literals would be helpful.

      1. 2

        Once I started thinking in terms of ordered/unordered/sparse data sets for my Lua programs, things sort of just clicked into place.. also, metatables, but also-also: lua-enumerable.

      2. 3

        not a deque, but: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.20.4164 has something similar.

        1. 1

          It also piques my curiosity as to whether or not an efficient deque implementation instead of cons cells makes more sense as a core data structure in a Lisp…

          I’ve been keen on toying around with writing some small lisps that are only thin wrappers around different possible core datastructures, usually the idea is to output a map (dictionary, hashmap, what have you).

          Keen to see other implementations of this, I have never looked much into Clojure, my exposure to lisps is mostly from Scheme - which has functions works working with alists, but no special syntax.

        2. 7

          I’ve gotten largely the same conclusion about Lua after working on extensions for the Textadept editor.

          Granted, I haven’t done a lot of work involving advanced concepts like metatables, but for most purposes, I found Lua much better to deal with than Vimscript. Thankfully, I’m not so used to Vim yet I have no difficulty switching text editors when I need to.

          1. 3

            I really enjoy working with Lua when I have the chance. The simplicity goes a long way, but there are definitely pain points given the very sparse standard library and simple syntax (for example, rolling your own class implementation in every project, adding in iterator helpers, etc).

            Imagine my excitement when I followed this article through a few other and came across MoonScript. I only had last evening to read through the docs, but I’m going to spend time today moving a small behavioral economics simulator I started writing recently into MoonScript and see how it goes.

            MoonScript describes itself as ‘Coffescript for Lua’. I’ve managed to avoid using Javascript, but “nice expressive syntactic sugar that compiles into Lua” sounds pretty nice. The project looks (again, at first glance) feature complete (the error rewriting makes me suspect this, as the lack of such feature has always prevented me from seriously getting into Clojure).

            1. 4

              The fact that I have to bundle along my own collection of enumerables/classes/iterator .lua files is, in my opinion, kind of a feature more than a bug. It means I can rely on a set of software tools that don’t change under me, and perform as expected .. I think other languages/frameworks compel/hinder this to some degree, but in the case of this old Lua salt, I rather enjoy adding my standard lua-local tools as a sub-repo for new projects. Its rather clean.

            2. 3

              I’m personally quite enamoured of Lua as well, and I definitely don’t hate it, and I don’t see why anyone would. Pretty much a lot of very, very productive software can be written in this language - it may not be pure or whatever, but it does offer a lot of bells and whistles to let sing in the parade however you want.

              Favourite thing to do in an afternoon: find some old C code and glom the Lua VM to it, then write some new code for the old apps. Easy, fun, and productive.