News for hackers. Stuff that matters.
Re:It's 2023, so of course I'm learning Common Lisp by dleslie on Wednesday July 26, 2023 @09:36PM (#36887739)
Eventually you need to work with other people, and using a common time-shared or multi user session is unlikely. Now consider that lisp images generally can't be easily diff'd or merged.

And with that the edit-and-continue paradigm loses much of its value. If you have to commit changes to a shared source file anyhow then you'll be not much worse off with debugging a core dump.

Re:It's 2023, so of course I'm learning Common Lisp by db48x on Wednesday July 26, 2023 @09:57PM (#36887900)
People say this a lot, but they fail to take into account that you can debug your server live as it continues to handle normal traffic. Even if you don’t deploy changes via the REPL, merely debugging the problem in a REPL without restarting anything is a huge win.
Re:It's 2023, so of course I'm learning Common Lisp by dleslie on Wednesday July 26, 2023 @10:05PM (#36887967)
Lots of languages that are not lisp have this ability.
Re:It's 2023, so of course I'm learning Common Lisp by em-bee on Wednesday July 26, 2023 @10:35PM (#36888205)
examples please, because so far i have only seen this from common lisp and smalltalk. there is also pike where i can reload classes or objects at runtime, thus avoiding a full restart, but it's not as closely integrated as in smalltalk and you actually have to build your app in a way that allows you to do that.
Re:It's 2023, so of course I'm learning Common Lisp by lenkite on Thursday July 27, 2023 @12:37AM (#36888975)
Java supports live debugging and profiling.
Re:It's 2023, so of course I'm learning Common Lisp by db48x on Thursday July 27, 2023 @01:31AM (#36889313)
But that’s not the same thing at all. If you’re debugging an exception in Java, you cannot continue execution as if the exception had not been thrown at all. With Common Lisp’s condition system you can.
Re:It's 2023, so of course I'm learning Common Lisp by lenkite on Thursday July 27, 2023 @06:17AM (#36891416)
Umm.. you can throw an exception, you can return to previous call frame, you can reload modified classes. If you want unlimited code modification, you can use dcevm https://github.com/dcevm/dcevm

https://www.jetbrains.com/help/idea/altering-the-program-s-e...

Re:It's 2023, so of course I'm learning Common Lisp by regularfry on Thursday July 27, 2023 @11:37AM (#36895179)
The question was whether you can debug a live service while it's handling live traffic. Not whether you can fix it. Java can definitely do the former, and definitely can't do the latter.
Re:It's 2023, so of course I'm learning Common Lisp by em-bee on Thursday July 27, 2023 @09:19PM (#36902126)
my question specifically was which languages/runtimes allow you to actually make changes to the code in a live process without restarting it.
Re:It's 2023, so of course I'm learning Common Lisp by regularfry on Friday July 28, 2023 @07:33AM (#36905406)
Your question moved the goalposts. Making change to a running system wasn't part of db48x's claim to which dleslie responded. It was explicitly excluded, in fact.
Re:It's 2023, so of course I'm learning Common Lisp by em-bee on Friday July 28, 2023 @08:23PM (#36915310)
ok, fair, but what i am asking about is a feature of common lisp (and smalltalk or pike), so i didn't pay attention to the exclusion. that was not deliberate. my bad. (maybe you could say i moved the goalpost back to the original topic)
Re:It's 2023, so of course I'm learning Common Lisp by dleslie on Thursday July 27, 2023 @02:29AM (#36889719)
JavaScript immediately comes to mind.
Re:It's 2023, so of course I'm learning Common Lisp by em-bee on Thursday July 27, 2023 @08:17AM (#36892333)
how do you do it? in the browsers debugger? maybe, but that is not integrated with your actual source files, so you have to be careful to track your changes and copy them to your source. that may help in some cases but isn't really practical.
Re:It's 2023, so of course I'm learning Common Lisp by pjc50 on Thursday July 27, 2023 @08:21AM (#36892364)
It's not always usable, but Visual Studio offers this for C# (works most of the time) or C++ (works in fewer cases because of the terrible header model)
Re:It's 2023, so of course I'm learning Common Lisp by em-bee on Thursday July 27, 2023 @09:12PM (#36902090)
but you wouldn't be able to use that on your production server, would you?
Re:It's 2023, so of course I'm learning Common Lisp by drekipus on Wednesday July 26, 2023 @10:39PM (#36888233)
* * *
Re:It's 2023, so of course I'm learning Common Lisp by db48x on Wednesday July 26, 2023 @11:05PM (#36888412)
I don’t think that they do. I know that Erlang has something similar; you can reload a module and it will gradually replace the old code as processes are replaced. In principle you could debug a single thread in a C (or C++) program without stopping the others, and some IDEs will let you edit the code and recompile while the program is running (they patch out the old function definition so that it jumps to the new one instead), but good luck doing that in production.

But don’t forget that in Common Lisp, you can redefine classes at run time as well as functions. All existing instances of the class will be updated to the new definition, and you can provide the code that decides how the old fields are translated into the new ones if the default behavior is insufficient. Good luck doing that in C or C++.

My favorite story involved a race condition that was discovered in the code running on a satellite, after it had been launched. The software on the satellite was mostly written in Common Lisp (there was a C component as well), so they opened a connection to the satellite, started the REPL, debugged the problem, and uploaded replacement code (which obviously added a lock or something) to the satellite all through that same REPL. While the satellite was a hundred million miles away from Earth, and while it kept performing it’s other duties. You can’t do that on a system which merely dumps core any time something unexpected happens.

Re:It's 2023, so of course I'm learning Common Lisp by maxwelljoslyn on Thursday July 27, 2023 @01:19AM (#36889230)
Said "software on satellite" story is from Ron Garret, for anyone interested.

https://flownet.com/gat/jpl-lisp.html

> During that time we were able to debug and fix a race condition that had not shown up during ground testing. (Debugging a program running on a $100M piece of hardware that is 100 million miles away is an interesting experience. Having a read-eval-print loop running on the spacecraft proved invaluable in finding and fixing the problem.

Re:It's 2023, so of course I'm learning Common Lisp by Capricorn2481 on Thursday July 27, 2023 @01:08AM (#36889161)
I'm confused. Why aren't you all just working on your own machines?
Re:It's 2023, so of course I'm learning Common Lisp by dleslie on Thursday July 27, 2023 @02:33AM (#36889746)
The classic lisp way is to build a runtime image by editing the image while running it, then dumping a binary. You never specifically need to load a source file.

But you can't easily collaborate with that style of development.

Re:It's 2023, so of course I'm learning Common Lisp by foobarbaz33 on Thursday July 27, 2023 @09:00AM (#36892763)
With lisp you typically develop in source files, versioned with Git. The same as any other language. Source files and live development are not mutually exclusive. SLIME can send code snippets from your file over to the REPL for live development. You have your cake and eat it too.

The REPL (or scratch buffer) is typically used for testing/observing. Not the actual source code development. Although it is possible to never write your source code to a file if you're just playing around with a toy experiment.

Re:It's 2023, so of course I'm learning Common Lisp by kgwgk on Thursday July 27, 2023 @09:26AM (#36893127)
> The classic lisp way is to build a runtime image by editing the image while running it, then dumping a binary. You never specifically need to load a source file.

Says who?