Hacker News new | ask | show | jobs
by alexjurkiewicz 58 days ago
I think half the article talks about why CL is good because it can resume from an exception, and half the article talks about why DSLs are good.

I think others have pointed out that most modern scripting languages can halt at exceptions without unwinding the stack. Python & Node both support this with core tooling.

As for DSLs, they constrain the LLM which generally helps with code quality. However why implement your DSL in the unconstrained chaos of CL? You can write DSLs in Rust which gives you static typing, a borrow checker, and clippy.

3 comments

Common Lisp has these capabilities _without_ dev tooling, via its:

- Conditions[0]

- Evaluation and Compilation[1]

I use both extensively while developing, debugging and analysing. With SLIME (this is a standard and very very slimmed out development aid) you add a debugger hook that allows restart, return from, move down, move up and etc into your available RESTARTs.

[0] https://www.lispworks.com/documentation/HyperSpec/Body/09_.h...

[1] https://www.lispworks.com/documentation/HyperSpec/Body/03_.h...

What’s missing in most languages is truly native hot reload. Python, for all its dynamicism and being lisp for dictionaries, surprisingly can’t really do it. Maybe node can, but as far as I can tell typescript can’t and I’m not letting the shoggoths touch plain js.
I've never understood this. You can't just combine the state of an old program with new code, without lots of weird things potentially happening. The algorithms and all intermediate products would have to match, at every step of the programs.
That’s why working with lisp feels like touching alien tech - it works, it’s designed for that exact workflow.

(It’s also essentially pointless when your unit of deployment is a disposable container and not a long running lisp system, but it at least makes development a bit nicer)

Weird thing will happen in Lisp just the same when the program state doesn’t have the shape the changed program expects anymore, or vice versa.

This is like claiming that you don’t have type errors in Lisp because everything is a list in Lisp. In reality type errors will either manifest in different ways, or still explicitly occur [0].

[0] https://lisp-docs.github.io/cl-language-reference/chap-4/e-e...

> The algorithms and all intermediate products would have to match, at every step of the programs

This is where the functional programming model really shines - there typically isn't a bunch of hidden state floating around to break hot-reloading

Almost nobody programs in functional style in Common Lisp, even though it’s possible. In the vast majority of CL programs there’s tons of global state and yet one learns quickly how to architect and structure the program in order to make image based development and runtime code modification a breeze.

So no, the magic sauce is not “functional”, it’s that CL stemming from the Lisp Machine paradigm is designed for that sort of experience whereas something like Python very much isn’t. And it shows (there’s no image based development in Python that doesn’t end up creating more problems than it solves but image based development is not only the norm in CL but also tremendously empowering).

"one learns quickly how to architect and structure the program in order to make image based development and runtime code modification a breeze."

Are you sure this isn't just doing functional programming, and not realizing it?

Yes I’m sure. Take a careful look at Symbolics Genera or even Emacs and you will realize that functional has nothing to do with it.
> You can't just combine the state of an old program with new code

It works fine and was designed for this use case.

Scratch is probably the most used programming language with hot reloading, allowed for by its persistent global state.

Web development supports hot reloading modules, but this is effectively just dynamic imports and relies on the app being written for a library/framework that encourages pure code; it doesn’t kill the old module.

> You can write DSLs in Rust which gives you static typing, a borrow checker, and clippy.

It also makes your agent wait for the compiler to finish.