[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:03832] Re: Order of overwriting

From: Dave Thomas <Dave@...>
Date: 2000-07-05 14:59:44 UTC
List: ruby-talk #3832
ts <decoux@moulon.inra.fr> writes:

>  'include module' include method in the super class.

Actually no overwriting of methods occurs. When you include a module,
Ruby constructs a proxy class that has a method table the points to
the module's method table, and inserts this proxy as the immediate
parent of the class that did the including.

So:

      class Ernie < Puppet        Ernie  <--  Puppet

then

         include Duckie           Ernie  <-- Proxy <-- Puppet
                                               |
                                               V
                                             Duckie



If e = Ernie.new, then in the first case e.squeak will be resolved
by first looking in Ernie's method table, then in Puppet's (and the in 
Objects). In the second case, the order will be Ernie, Duckie, then
Puppet.


Regards



Dave

In This Thread

Prev Next