Hi --

On Mon, 28 Oct 2002, William Djaja Tjokroaminata wrote:

> Brian Candler <B.Candler / pobox.com> wrote:
>
> > The 'new' method which was inherited by S (or at least gives the
> > appearance of being inherited) doesn't need a wrapper though:
> > S.new returns an S, not a String. Perhaps that's why it's
> > surprising that the inherited S#+ returns a String not an S.
>
> I agree with everything that you said.  I guess in a typed language such
> as C++, this is not a problem, because the same data (i.e., bit
> patterns) can be interpreted differently based on the type of the variable
> that is used to access the data.  In a "typeless" language such as Ruby,
> on the other hand, the type itself is carried in the data, and therefore I
> got this "surprise".
>
> I personally don't know which is the "right" way to do OO design.  Whereas
> a question such as the lack of Boolean parent class in Ruby is
> probably more theoretical than practical, a question like this is I think
> very practical, because it dictates the whole OO design.  I am rather
> disappointed actually, because very few (or almost none of the) people
> who usually discussed OO-related issues state their opinions.  (Or
> probably this is just one of the "unsolved problems" in Ruby, along with
> others like private variables and block local variables?)

I think it is.  See the threads at and around
<http://www.ruby-talk.org/21745> and <http://www.ruby-talk.org/11381>.
I believe it's all still under consideration by Matz.  (Matz?)


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav