adding methods to instances

Ned Konz ned at bike-nomad.com
Wed Apr 11 19:37:31 UTC 2001


On Wednesday 11 April 2001 12:30, Karl Ramberg wrote:
> Why does not Smalltalk allow adding methods to instances ?

Because the method lookup is done in a class-based methodDictionary?

You could make an anonymous copy of a class and replace one or more 
CompiledMethods in its methodDictionary (I suspect, having done this 
successfully in VW) then use that class to make one or more instances that 
would have the new behavior.

But the tools don't currently support that kind of subterfuge.

I don't know whether you can change the class pointer of an object at runtime.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com





More information about the Squeak-dev mailing list