Talk:Add a variable to a class instance at runtime: Difference between revisions

Try to help understanding of the task description
(if that is monkeypatching, Smalltalk (afaik) can't. right?)
 
(Try to help understanding of the task description)
Line 8:
 
To achieve what requested, one could just create a "special" use-once subclass and '''then''' create the instance of it... but this is not so special, we already know that every OO language can, and it seems to me it would not be exactly what the task wants. --[[User:ShinTakezou|ShinTakezou]] 13:26, 19 May 2009 (UTC)
 
: The task description is clear enough. Add the new things to an instance of the class without modifying the class (i.e., other instances of the class must be unaffected). What would be a more exciting way to do it would be to dynamically create a subclass of the class with the required modifications and then change the class of the instance ''after creation'' to the subclass. For one thing, that's a sequence of operations that shows that a simple type algebra isn't sufficient to understand the object system… –[[User:Dkf|Donal Fellows]] 01:32, 5 January 2010 (UTC)
Anonymous user