4 ms·
> the situation is the same for Lisp with its dynamic typing Common Lisp and Smalltalk (quintessential dynamic systems) both track the existing instances of a
by Jtsummers 4y ago
> the situation is the same for Lisp with its dynamic typing
Common Lisp and Smalltalk (quintessential dynamic systems) both track the existing instances of a class. If you update the class definition then they can update the existing instances of the class. In CL you'd want to specialize `update-instance-for-redefined-class` to handle the update.
http://clhs.lisp.se/Body/f_upda_1.htm#update-instance-for-redefined-class http://clhs.lisp.se/Body/f_upda_1.htm#update-instance-for-re...
- thelopa 4y agoMost CL implementations don’t “track” the instances so much as have them point at a proxy for the real class object. When redefining a class, the old proxy object is marked as stale and then updated to point at the new class. This allows the runtime to lazily update instances to the new class (using the method you linked to) as they are encountered. As a result, you can have instances from several different class generations kicking around in memory.