Comment by nequo

2 years ago

> You can inspect anything, patch anything. When paired with an editor, that means you can only apply part of the code and then rerun part of the code. You can also try stuff and then formalize stuff down in code, no need to rerun the whole program.

I’ve heard this a lot about Lisp. But doesn't this lead to greater cognitive complexity because every time you patch your running code, you have to keep in mind the state of the running program and mentally check whether your patch affects any part of that state?

A lot of people do data analysis this way in R/Python who aren’t programmers either by training or for a living, and it is not a practice that generally leads to bug-free outcomes. This has also mirrored my experience with Emacs which is a Lisp machine, maybe getting closer to Common Lisp’s programming environment.

Is this process of runtime modification fundamentally different in CL? What am I misunderstanding?

When you redefine a function in CL, every function that use this function is notified of the change and pickup the new version. And because it's functional and you're not supposed to modify the state outside your function, everything will keep churning.

The issue with emacs is the sheer number of variables. And the fact they're global. That leads you to do stuff you shouldn't do. But the principles are essentially the same. And in CL, you can snapshot the current state of your program to a file. Then restart later, instead of reloading the environment from the code.

A quick demo: https://youtu.be/jBBS4FeY7XM