[plt-scheme] "appending" to classes rather than extending

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Mar 6 09:13:53 EST 2008

On Mar 6, 2008, at 9:06 AM, Chris Uzdavinis wrote:

> In Ruby, when you extend types, it affects existing objects of that
> type too.  Below, my_object is bound to an object created when X is an
> "empty" class, and then I add a bar method, and it's immediately
> available.
>
>   class X
>   end
>
>   my_object = X.new
>
>   class X
>     def bar
>       puts "BAR"
>     end
>   end
>
>   my_object.bar # This works

I was afraid it would.

> Out of curiousity, is that (or something like that) possible with the
> mzScheme object model?

Not that I can imagine. (Indeed, in my mental model of OO/classes
this means re-opening a closure and or a near-textual representation.
Either way I am afraid that this is a bit too dynamic for me.)

-- Matthias



Posted on the users mailing list.