Hacker News new | ask | show | jobs
by baq 60 days ago
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.
3 comments

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.