Yukihiro Matsumoto
2/17/2007 2:21:00 PM
Hi,
In message "Re: Oppinions on RCR for dup on immutable classes"
on Sat, 17 Feb 2007 22:51:06 +0900, Stefan Rusterholz <apeiros@gmx.net> writes:
|With current implementation, the only way to figure if an object can be
|dup'ed is by dup it and catch the exception. I don't know how imperative
|duck-typing is for ruby, but this way actively prohibits it.
As far as I understand, DuckTyping is not something based on method
existence, but something letting them raise error without explicit
type checking.
|As said before, the issue can be worked around (as you say e.g. via
|exception handling), but following your argument, my question would be:
|why implement a method that can't be executed?
We haven't implemented a method that can't be executed. Object#dup
just fails if the object is not able to be duped. Am I missing
something?
matz.