From: Asfand Yar Qazi Date: 2003-12-01T23:32:06+09:00 Subject: Re: class << x Greg McIntyre wrote: > "Mark J. Reed" wrote: > >>On Sun, Nov 30, 2003 at 02:55:09PM +1100, Greg McIntyre wrote: >> >>>I didn't ask what it does. I understand perfectly what "class << x" >>>does and how it works and all about anonymous classes. >> >>I apologize; I was only trying to help, not impugn your knowledge, >>And the reading "open x's class for modification" didn't sound like >>you understood it, since "class << x" *doesn't* modify x's class, but >>rather creates a new subclass just for x. >> >> >>>What I asked was, why is the syntax "class << x"? Is there a reason? >>>Why "class << x"? >> >>It's designed to suggest that something very similar to >>"class X < Y" (which defines a new class X as a subclass of Y) >>is going on. The main differences are: >> >> 1. the new class has no name (so there's nothing on the left of >> the <<) >> >> 2. the object on the right is not used directly as the >> superclass, >> even if it happens to be a class object; rather, its class >> is used. >> >> 2. that object is modified such that it becomes an instance of >> the new class (whereas class X < Y doesn't modify Y at all). > > > I'm sorry, I was very curt. Thanks for spending time to answer me fully. > That's something I love about ruby-talk and I'd hate to be unthankful of > it. I learnt from it. So it was good! -- http://www.it-is-truth.org/