Live data from Hacker News

Show HN: Using Common Lisp from Inside the Browser

turtleware.eu

11–20 of 32 posts

Re: Show HN: Using Common Lisp from Inside the Browser

#11
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.

Re: Show HN: Using Common Lisp from Inside the Browser

#12

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 somethin…

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.

Re: Show HN: Using Common Lisp from Inside the Browser

#13
post #3

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.

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.

Re: Show HN: Using Common Lisp from Inside the Browser

#14

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 somethin…

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.

CL is the Ditto (pokemon) of programming langauges. It commits to nothing and does everything better than you'd expect. The problem is its very much a lone warrior type of language. you can attain great productivity due to macros and just how maleable it is but it makes it near impossible to get a team to work together on it without very extensive styling and conventions strictly adhered to by the team. In a way, you could say its a direct influence to go, in that the go team saw everything common lisp did and decided to do the opposite.

Re: Show HN: Using Common Lisp from Inside the Browser

#15

Earlier quoted context omitted.

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.

CL is the Ditto (pokemon) of programming langauges. It commits to nothing and does everything better than you'd expect. The problem is its very much a lone warrior type of language. you can attain great productivity due to macros and just how maleable it is but it makes it near impossible to get a team to work together on it without very extensive styling and conventions strictly adhered to by the team. In a way, you…

> It commits to nothing and does everything better than you'd expect.

Idk man, every time someone makes that claim my immediate reaction is: "what's the catch?". I much rather use 5 tools designed for specific purposes than general-purpose tools that are 50% good at 5 tasks.

Re: Show HN: Using Common Lisp from Inside the Browser

#16

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 somethin…

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?

Re: Show HN: Using Common Lisp from Inside the Browser

#17
post #9

Earlier quoted context omitted.

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.

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 - wa…

> ... culturally it's got a long history of being more functional

Sure, but CL also culturally has a long history of macro-ridden code that make it harder to understand other people's code.

We already suffer from dozens of JS frameworks. Just imagine what it would look like under a CL-dominant world...

Re: Show HN: Using Common Lisp from Inside the Browser

#18

Earlier quoted context omitted.

CL is the Ditto (pokemon) of programming langauges. It commits to nothing and does everything better than you'd expect. The problem is its very much a lone warrior type of language. you can attain great productivity due to macros and just how maleable it is but it makes it near impossible to get a team to work together on it without very extensive styling and conventions strictly adhered to by the team. In a way, you…

> It commits to nothing and does everything better than you'd expect. Idk man, every time someone makes that claim my immediate reaction is: "what's the catch?". I much rather use 5 tools designed for specific purposes than general-purpose tools that are 50% good at 5 tasks.

the catch is that the langauge is so maleable that no two lisp codebases look the same. Makes it very difficult to establish broader idioms. But in terms of what it cando, its got ridiculously good runtime speed for how dymanic it is and the debugger is one of the best around. you can literally pause on an exception, rewind, fix your code and continue from where you left off.

Re: Show HN: Using Common Lisp from Inside the Browser

#19

Earlier quoted context omitted.

> It commits to nothing and does everything better than you'd expect. Idk man, every time someone makes that claim my immediate reaction is: "what's the catch?". I much rather use 5 tools designed for specific purposes than general-purpose tools that are 50% good at 5 tasks.

the catch is that the langauge is so maleable that no two lisp codebases look the same. Makes it very difficult to establish broader idioms. But in terms of what it cando, its got ridiculously good runtime speed for how dymanic it is and the debugger is one of the best around. you can literally pause on an exception, rewind, fix your code and continue from where you left off.

I love the restarts system but the fact that the industry as a whole chose other approaches makes me wonder if there's something the "wisdom of the crowds" knows that I'm not aware of.

> you can literally pause on an exception, rewind, fix your code and continue from where you left off.

Does it only work on source codes or can I distribute a binary and let my users debug the code like this? Should I distribute the 'image' for it to work?

And is the fix temporary (until the program dies) or permanant?

Re: Show HN: Using Common Lisp from Inside the Browser

#20

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 somethin…

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?

Fair point! Programming paradigms aren't objectively superior - they're tools, and different people's brains work differently. Many problems are naturally iterative, and forcing them into recursive patterns can feel awkward. That said, some problems become much cleaner with FP approaches - data transformations, avoiding shared state bugs, or mathematical computations. It's worth having both tools available. use imperative when you think in steps, use functional when you think in transformations. Don't force one paradigm everywhere just because it's trendy or "pure."

But do give yourself this gift - even if you end up preferring imperative style for day-to-day work, learning Haskell or Clojure can be genuinely eye-opening.

It's like learning a foreign language - even if you never become fluent, it changes how you think about your native language. You'll start seeing patterns and abstractions you missed before, even in imperative code.

upd: sorry, only after posting it I noticed your "as someone who's done both". Just wanted to point out that here my suggestion is aimed not to you directly, but to a "proverbial" programmer, I used "you" in more general sense.

Post reply on HN