4 ms·
The Miracle of Smalltalk's become:
- noss 17y agoI always wondered what this was able to do and how it worked technically. It's one of those things I put in a SEP-field and never thought about again. It reminds me about an Objective-C feature I also never fully understood. I believe it was "-poseAs:".
- mahmud 17y agoA more civiled, less procedural version of CL's change-class + update-instance-for-redifined-class.
- s-phi-nl 17y agoI was wondering what the lisp version (if any) of become: would be. Thanks for saying it.
- deleted 17y ago[deleted]
- didroe 17y agoA good compromise would be if you could specify an object as being "replacable" and then it would have the extra layer of indirection (the table) to make it fast. That way you don't pay a penalty when you're not using that feature and/or don't have to walk the heap. It would also be better for security in that you'd have to explicitly state which objects were allowed to be replaced. You have to think about needing that feature in advance though.
- avibryant 17y agoI believe Squeak just adds the extra indirection when #become: is used, by turning the old objects into "forwarders". On the next full GC, the forwarders get cleaned up and the extra indirection removed.