4 ms·
Could you expand on the REPL bit? Having worked with JS, Python and Elixir, they feel more or less the same. What’s Lisps have that these don’t?
by slekker 4y ago
Could you expand on the REPL bit? Having worked with JS, Python and Elixir, they feel more or less the same. What’s Lisps have that these don’t?
- bjoli 4y agoSo, I would say the idea of dynamic redefinition is probably the big thing: In cl I can redefine a class and have all instances updated while the program is running. I would also say that the error management is also beyond fantastic. Say you run a function, and deep inside the call stack there is an error. In CL you can actually update the faulty function and just continue executing at the point of the error. For someone like me without any intellectual rigour at all, this lends itself to a kind explorative programming I really like.
- phoe-krk 4y agoThe Lisp instinct is to make a change in a file and immediately hit C-c C-c in Emacs, at which point the change goes live in the system - no matter if it's a variable or a function that you have changed or something else. You don't need to reload the full module like in BEAM languages like Erlang or Elixir, you can modify a single function or a form without the need to make a version upgrade to the processes running your code - the next time any thread, including e.g. an already running game loop, ends up calling the new function, it's the new version of the function that will end up being called.
- ramchip 4y agoVersion upgrades are not needed on BEAM anymore than they are in Lisp, you can just reload a module and code will start using the new version.
- phoe-krk 4y agoTIL, that's a big thing! When was that change made?
- ramchip 4y agoI don't think it's recent, as far as I know. Versioning, appup / relup, etc. are really for upgrading production deployments live, when you need special instructions to pause processes or update their internal state before loading new code. In development, you can ignore all that and just reload modules directly. e.g. with "r" in the Elixir REPL. Once that's done any external call (`MyModule.add(1,2)`) will go to the new version of the code, while local calls (`add(1,2)`) stay on the same version. The Phoenix web framework will also auto-reload any module that has changed on disk when handling a web request in dev mode.
- ravi-delia 4y agoI personally prefer SLIME over any IEX client I've ever seen, but that's not a limitation of Elixir. Since Erlang has a Smalltalk-esq image just like CL does, the Elixir REPL is in principle as powerful as a Lisp's. In practice CL has lots of additional little things which are nice, like the ability to update instances in place after changing a class or DEFVAR forms which don't clobber their contents on reloads, but for me most of the advantage comes from just how well designed SLIME is.