D
David Garamond
I read:
http://pub.cozmixng.org/~the-rwiki/rw-cgi.rb?cmd=view;name=Ruby2.0MethodSearchRuleEnglish
and was feeling disturbed about this new Ruby2 behaviour.
class C
def process
# ...
util
end
def util
# ...
end
end
class CC < C
def util
# ...
end
end
CC.new.process # C#process expects C#util,
# but calls CC#util
Why is this a problem? Isn't it what people expect in OO? I'm not an OO
expert, but isn't this one of the supposedly unique feature/benefit of
OO: allowing old code to call new code. I believe it's called polymorphism?
Now Ruby2 wants to change so that 'util' in C method calls C#util and
'self.util' calls CC#util. I very much prefer 'self.util' to be the one
that calls C#util (and I don't think I'll ever use it a lot). The latter
is backwards compatible and how virtually all other languages behave.
Regards,
dave
http://pub.cozmixng.org/~the-rwiki/rw-cgi.rb?cmd=view;name=Ruby2.0MethodSearchRuleEnglish
and was feeling disturbed about this new Ruby2 behaviour.
class C
def process
# ...
util
end
def util
# ...
end
end
class CC < C
def util
# ...
end
end
CC.new.process # C#process expects C#util,
# but calls CC#util
Why is this a problem? Isn't it what people expect in OO? I'm not an OO
expert, but isn't this one of the supposedly unique feature/benefit of
OO: allowing old code to call new code. I believe it's called polymorphism?
Now Ruby2 wants to change so that 'util' in C method calls C#util and
'self.util' calls CC#util. I very much prefer 'self.util' to be the one
that calls C#util (and I don't think I'll ever use it a lot). The latter
is backwards compatible and how virtually all other languages behave.
Regards,
dave