top | item 44971744

Show HN: Using Common Lisp from Inside the Browser

111 points| jackdaniel | 6 months ago |turtleware.eu

31 comments

order

adamddev1|6 months 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 ?

sdsd|6 months ago

I wonder if, in that world, Lisp would be the boring corporate language, and HN would dream of a world where object orientation (which is clearly superior) never had a chance to leap from academia to the mainstream, and hackers post their niche flavors of Java and Smalltalk here.

umanwizard|6 months 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.

shadowgovt|6 months ago

It's hard to predict. There's a nonzero possibility that in that world, developers would have rejected the Netscape scripting solution, embraced the alternative that VBScript support in IE briefly represented, and we'd either be in a world where Microsoft dominated the web because only their browser did the fancy stuff that web 2.0 ended up needing to support ecommerce... Or where a couple of mud-pit-fight court cases had resulted in a vbscript-alike being the lingua franca of web scripting because Microsoft lost their exclusive control over it.

bitwize|6 months 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.

behnamoh|6 months ago

You say that as if FP is objectively superior to the imperative style, but as someone who's done both, I still find FP style like "swimming against the river"—if my brain thinks in steps and iterations, why do the mental gymnastics to convert that into recursion?

octopoc|6 months 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.

shadowgovt|6 months ago

My only concern with this approach from an ecosystem standpoint is that runtimes (and more importantly, their standard libraries) can be expensive. JS is still the heavyweight engine that everyone running a browser already has installed; a world where the browser has to download a novel runtime per website is going to be hard on the end-user on the back of a low-bandwidth connection.

... but it doesn't have to be that way. Proper tree-shaking of libraries and smart caching of common resources should make it possible for that cost to get minimized or amortized.

iainctduncan|6 months ago

I will definitely look at this in detail. I'm doing something similar with S7 Scheme (a scheme that is heavily Common Lisp influenced), and it's working really well. Getting the plumbing going was a fair bit of work, but it's a huge win to be able to reuse my domain-code engine across the browser, C++ apps, and in Max/MSP (through my OSS Scheme for Max extension). Writing music theory related domain code is much nicer in a symbolic lisp family language than in JS.