At 9:54 AM +0900 1/10/02, Albert Wagner wrote:
>Thank you for the reply, Matt.  I am aware of what is usual in Ruby.
>However, my reasons for doing it are, I think, justified.

And what would those reasons be?  You said you have a "murky idea" of
how to achieve what you want.  What exactly "do you want"?  Not "here
is some non-working code that I want to use", but "I want class B to
be like class A except that it should <something>".

>Note that I am not overriding A#new, but actually attempting to
>subclass A with B and adding behaviour to A#new through B#new.
>A#new is left intact to be executed by super in B#new.  My problem
>is that I expected the args a,b and c to be passed from B#new to
>B#initialize, and they are not.  What changes should I make in B to
>have a, b, and c given to B#initialize?

For purposes of this discussion, assume that the default implementation
of 'new' in A does:
          obtain room (malloc the memory) to hold an object of
             type 'class A'
          fill in the "class fields" of that object (such as
             location of all of it's methods)
          call the 'initialize' method for that object

Based on the code you've written, I see no reason why you should be
overriding 'new'.  You just want to override 'initialize'.  You are
doing nothing wrt obtaining memory for the correct class of object.
You're having 'B.new' call 'A.new', I suspect that will only allocate
enough memory for an object of *class A*.

I probably shouldn't speaking here because I am new to ruby, but in
a general OO-sense I don't understand why you would ever override 'new'.

-- 
Garance Alistair Drosehn            =   gad / eclipse.acs.rpi.edu
Senior Systems Programmer           or  gad / freebsd.org
Rensselaer Polytechnic Institute    or  drosih / rpi.edu