From: Jean-denis Vauguet Date: 2010-03-22T05:25:44+09:00 Subject: Re: A plugin system using extend James Edward Gray II wrote: > On Mar 21, 2010, at 2:51 PM, Jean-denis Vauguet wrote: >> stuff. > This isn't totally accurate. extend() is a stupid simple shortcut that > really is just an include. This code: > > obj.extend(Whatever) > > is identical to: > > class << obj > include Whatever > end > > So it really does all work the same. That's even better than expected! I did not think about the singleton class nor did I look at the real implementations (which demonstrates it *is* important to master along the semantics ;)). Thanks for the correction. > The reason it moves the methods in front of the main class though is > that the singleton class is in front of the main class. Thus including > the module behind that class still has them in front of the main class. > > I talked about this quite a bit in my presentation at LSRC last year: > > Video: > http://lsrc2009.confreaks.com/module-magic-james-edward-gray-ii-28-aug-2009.html > Slides: http://grayproductions.net/ruby/module_magic.tar.gz > > The spirit of what you said is all right on though. -- Posted via http://www.ruby-forum.com/.