Austin Ziegler <austin / halostatue.ca> wrote:

> This is where Ruby's typeless variables (not typeless objects)
> causes problems. In the compiled language, the variable 'a' has a
> distinct type. With respect to your example, I would *expect* that
> 'a' would take on the type of Parent in Ruby. What I don't expect,
> however, is for:

>     a = a + b

> to take on the type of Parent. After all, we're really doing:

>     a = a.+(b)

> So the typeness of a should be carried, even though it's the
> Parent's operator which is called. It's rather like the operator had
> been declared without 'virtual' in C++.

Very well said, Austin, very well said.

> It's not an easy problem. Jim's solution is a decent one, and it
> might be that some syntactic sugar could be provided.

Although I don't know the extent of the consequences of doing
"self.class.something" in the classes, it looks like a good idea to
me too.  Whether it is automatic or manual, probably it is
secondary (it is like, as you said, having the 'virtual' keyword in
C++, whereas in Java every function is virtual).  I am curious in knowing
Matz's thought currently, whether he even thinks that this is indeed a
problem.

Regards,

Bill