News for hackers. Stuff that matters.
Re:It's 2023, so of course I'm learning Common Lisp by vkazanov on Friday July 28, 2023 @08:26AM (#36905844)
BTW, you mentioned that classes can be redefined in Ruby.

How does this work for existing class instances? Anonymous pieces of code, methods, etc? Even lisp itself does not save from all the corner cases, it's the dev culture that makes all these wonderful things possible.

Re:It's 2023, so of course I'm learning Common Lisp by regularfry on Saturday July 29, 2023 @11:18AM (#36921094)
Existing instances get the new capabilities.

The first time you do `class A....end` you're defining the class. Instances when they are created keep a reference to that class - which itself is just another object, an instance of the class `Class` which just so happens to be assigned to the constant `A`. If you later say `class A... end` and redefine a method, or add something new, what you're actually doing is reopening the same class object to add or change its contents, so the reference to that class doesn't change and all the instances will get the new behaviour. If you redefine a method, calls to that method name will go to the new implementation.

So in that sense it works like you'd expect, I think. As I said, Ruby is very lispy - Matz lists Lisp as one of the inspirations, and I think I'm right in saying he even cribbed some implementation details from elisp early on.