Show HN: Using Common Lisp from Inside the Browser

(turtleware.eu)

65 points | by jackdaniel 5 hours ago ago

8 comments

  • adamddev1 3 hours ago ago

    Ah, in an alternate world where Brendan Eich wasn't pressured by his superiors to make JS more Java-like, we could have had something like this as very normal.

    I wonder how much faster that would have pushed the world into FP ideas. While sometimes I prefer the bracket/C syntax, I wonder how things would have evolved if JS was a lisp originally. Instead of things moving to TypeScript, would they be moving to something like typed Lisp or OCaml, or PureScript ?

    • umanwizard 2 hours ago ago

      Is CL really particularly more “functional” than JavaScript? I don’t know CL but I know it bears some passing similarity to Emacs Lisp, which is usually written in a pretty imperative style. Sure, it has first-class closures but so does JS.

      • wk_end an hour ago ago

        I kind of agree, but in the interest of discussion: even if CL isn't necessarily a more functional language in practice, culturally it's got a long history of being more functional. It took something like a decade at least for people to widely recognize to how elegant (in its quirky way) JavaScript could be. Just as a point of comparison (I'm sure the idea goes further back) PAIP - one of the definitive CL books - was first published in 1991 and encourages pure functions and immutability wherever possible.

        Devs in the 90s were handed a language that looked like a weird Java and so they programmed it like a weird Java. If they were handed a language that looked like Lisp instead, maybe they would have made their way to SICP that much sooner.

      • taeric 2 hours ago ago

        As the sibling says, CL can be written in most any style. Which, I think it is fair to say for any general programming language? The book Exercises in Programming Style highlights that. That said, CL feels far friendlier to the various styles than other languages, to me.

        Link to book on Amazon: https://www.amazon.com/dp/0367350203

      • jackdaniel 2 hours ago ago

        CL enables many paradigms of programming, including functional one and imperative. Currently the most popular way of programming among CL programmers is OOP with CLOS.

    • bitwize 2 hours ago ago

      The JS backend to Gambit is now pretty mature. If you're willing to deal with Scheme, Gambit, and its FFI, you can live in that alternate "Scheme in the browser" universe even without WASM.

      • jackdaniel 2 hours ago ago

        There's also Guile Hoots compiling directly to WASM.

  • octopoc 3 hours ago ago

    WebAssembly is about an improved Developer Experience. It lets us write in the languages we like :)

    I can't say how many times I've reinvented pieces of Common Lisp to do my job. Now I want to start a side project with this.