From: matz@... (Yukihiro Matsumoto) Date: 2003-11-20T05:47:50+09:00 Subject: Re: "stereotyping" (was: Re: Strong Typing (Re: Managing metadata about attribute types) Hi, In message "Re: "stereotyping" (was: Re: Strong Typing (Re: Managing metadata about attribute types)" on 03/11/20, "Sean O'Dell" writes: |> A class has interface; a class can be used as interface (by set of its |> methods); but it should not be checked by kind_of? or anything based |> on inheritance, just because it hinders flexibility of dynamic typing |> so much; remember StringIO or tempfile examples. | |But again, that flexibility is LOST when you have to pass an object to a |method that REQUIRES it to behave a certain way. The flexibility is already |gone; it wasn't eliminate by a language quirk, it was eliminated by the need |of the method being called. I'm not sure what you mean by "flexibility LOST". In your scenario in [ruby-talk:85611], certainly it is much easier to tell that your library is requiring Socket interface, but without that kind of interface check, no flexibility is lost, it's little bit hard to find out the semantics. Maybe we are referring different "flexibility". Mine is the one that allows replacing IO by StringIO. Currently we have no language support to check nor enforce them, but it's still possible, not lost. |I'm only talking about checking that a certain interface is present. Just for |the purpose of providing an informative error message when an object which |cannot fulfill the needs of a method is passed. Right now, it just explodes |with an ugly message about something that happened deep in the called method. |Something more informative would go a LONG way. | |Reconsider, Matz. Reconsider what? I didn't tell you any decision yet. I'm still the level of seeking what you mean. matz.