On Saturday 06 December 2003 04:31 pm, ts wrote: > >>>>> "T" == T Onoma <transami / runbox.com> writes: > > T> Can anyone take a look at this and tell me what the hek is happening > with T> extend? (as in Pickaxe Chapter 19) > > Well, I've not understood your problem. Thanks for responding, Guy. I'll explain better. > To simplify : by default (because it's possible to redefine what do ruby) > an extend can be seen as an include in the singleton class. "seen as an include in the singleton class": That's what confuses me. I can "see" this by combing the diagrams on Pickaxe pg. 246 and 247, no problem. But it dosen't explain to me why x isn't printed in my extend example. (I wish there way a way I could draw a picture of it here) > >> singleton: Mx [C, Object, Kernel] > >> > >> Notice in the singleton that "M" is invisible, but it does in fact exist > >> anonymously before C. > > M is not invisible : it just don't exist. You have just defined a method > #happy for `c', like the module M define a method #happy Indeed I have defined that method, but it is put in a an unnamed class, i.e. the singleton class. (Pickaxe Figure 19.2 on page 246, has a diagram of it.) I'm simply refering to it as M, analogous to the rest of the examples. This is why M is printed before x and dosen't simply replace x. T. [NOTE: I figured it out and it may be a bug in Ruby. At the the very least it is a "bugaboo". I'll explain in next message -T.]