• ☆ Yσɠƚԋσʂ ☆OP
      link
      fedilink
      2
      edit-2
      3 days ago

      I find that s-expression syntax is much better than anything I’ve used in the past. Basically, you’re expressing all your code using data structures. That means you don’t have a bunch of special syntax for expressing logic, and your code ends up being very simple and regular. There’s practically no ambiguity, syntax quirks, or edge cases to worry about. Lisp syntax does a great job following the principle of least astonishment. S-expressions can also be very concise, and I find it’s a very good balance between code being both simple and expressive.

      Another benefit is that the nesting of the code explicitly shows how pieces of logic relate to one another. This makes code easily scannable. If one function is nested in another, you know its output will be used by it and if it’s not then it won’t. These kinds of relations are not explicit in most languages. With Lisp, you effectively get a diagram of your code for free.

      The parens also allow for things like Paredit where the code can be manipulated structurally by the editor. You can select an expression, reparent it, move it around etc. You’re no longer working with lines of code, but with little blocks of logic. Editing code becomes like playing with Lego, where you just snap pieces together to make things.

      Finally, using data structures to write code is what allows for the fantastic macro system. You can now take any piece of code and transform it like any other data structure using the same functions you’d apply to manipulating any other data.

      A powerful macro system allows most problems to be solved in user space. This allows the core language to stay small and focused with new ideas being expressed using libraries. A common problem I’ve noticed with most languages is that they grow and accumulate cruft over time. JavaScript is a prime example of this problem. As usage patterns change over time, and new ideas appear, the language keeps getting extended. This creates cognitive overhead, especially for new for users of the language, because the surface area keeps growing. Meanwhile, if you’re using libraries then you only need to know about the libraries that are currently in use, and you don’t have to worry about old ideas that wen out of fashion.

  • maegul (he/they)
    link
    fedilink
    English
    25 days ago

    The lua escape hatch is interesting.

    Are there other lisps like this? I’m guessing closure has some similar features re Java/JVM?