On Wed, 15 Mar 2006, David Corbin defenestrated me:

> On Wednesday 15 March 2006 09:02 pm, Charles O Nutter wrote:
> > including a module at the root level actually ends up including it into
> > Object, because all code runs within the context of a global Object
> > instance. 
> 
> Are you describing jruby , or ruby (or both).  It makes no sense to me why 
> including something in one instance would be like including it the class that 
> instance was created from. 

  We are describing ruby....Check this fragment out and run it in
Ruby:

module Foo
  def bar
    puts "BAR yarr"
  end
end

include Foo

9.bar

> > Calling include at root is actually like calling the private 
> > "include" method on the Object class, adding that module's capabilities to
> > all Object instances.
> 
> My book (pickaxe2) doesn't list "include" as a method for Object.  

  top-self (instance of Object you are doing the include in) provides its
own 'include'.  This include actually includes the module arg in Object.
You just added your own Kernel-like module into every class (because it 
got included in Object). 

I do not know where this is documented in pickaxe, but Ruby defines this as 
well.  Its not a bug...Its a feature. :)

-Tom

-- 
+ http://www.tc.umn.edu/~enebo +---- mailto:[EMAIL PROTECTED] ----+
| Thomas E Enebo, Protagonist  | "Luck favors the prepared    |
|                              |  mind." -Louis Pasteur       |


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Jruby-devel mailing list
Jruby-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jruby-devel

Reply via email to