Doug Edmunds writes:

> #conceptual questions abound

Well, for Bar and Foo, you don't seem to understand the semantics 
of class creation.

Think of it this way.  The interpreter reads through your class files,
executing things as it gets to them, creating methods, creating
instance variables, and so on.  When it gets to the "puts" statements,
it just executes them, at read-time, along with everything else.

Since those "puts" statements were not associated with the initialize
method, they are not executed at every object creation.  They're just
run once, when the class definition is read.

> z = "\nJust can call me 'z'\n"
> puts z
> puts z.type
> puts "What about z? It is inside a class?\n\n"

Nope, it's just being executed, like the others.


-- 
Johann Hibschman                           johann / physics.berkeley.edu