M
Mystifier
------=_NextPart_000_0064_01C504CA.B67C9510
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi
=20
The current situation in Ruby with method calls is=20
=20
class A
def meth(arg1)
end
end
=20
class B < A
def meth(arg1,arg2)
end
end
=20
a =3D A.new
b =3D B.new
=20
b.meth(1,2) is fine but a.meth(1,2) . This is fine but what one assumes =
is
that when a method is overridden, you wish to override the =
implementation.
In that case, this is a problem.
=20
My suggestion is 2 options.
=20
Option 1:
Make all the methods as variable arguments. If a method is get more
arguments then it uses, it can safely ignore the extra ones. In case it =
gets
lesser ones (I am not sure here) , it may take the values as nil.
I do not think this is a good option but messaging based languages like =
Ruby
might prefer them.
=20
Option 2:
Mangle method names with number of arguments. meth in class A becomes =
meth_1
and meth in class B becomes meth_2. So, B is not actually overriding the
meth.
=20
regards,
Mystifier
=20
http://vuby.berlios.de
=20
=20
=20
------=_NextPart_000_0064_01C504CA.B67C9510--
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi
=20
The current situation in Ruby with method calls is=20
=20
class A
def meth(arg1)
end
end
=20
class B < A
def meth(arg1,arg2)
end
end
=20
a =3D A.new
b =3D B.new
=20
b.meth(1,2) is fine but a.meth(1,2) . This is fine but what one assumes =
is
that when a method is overridden, you wish to override the =
implementation.
In that case, this is a problem.
=20
My suggestion is 2 options.
=20
Option 1:
Make all the methods as variable arguments. If a method is get more
arguments then it uses, it can safely ignore the extra ones. In case it =
gets
lesser ones (I am not sure here) , it may take the values as nil.
I do not think this is a good option but messaging based languages like =
Ruby
might prefer them.
=20
Option 2:
Mangle method names with number of arguments. meth in class A becomes =
meth_1
and meth in class B becomes meth_2. So, B is not actually overriding the
meth.
=20
regards,
Mystifier
=20
http://vuby.berlios.de
=20
=20
=20
------=_NextPart_000_0064_01C504CA.B67C9510--