From: Austin Ziegler Date: 2003-11-20T06:10:50+09:00 Subject: Re: "stereotyping" (was: Re: Strong Typing (Re: Managing metadata about attribute types) On Thu, 20 Nov 2003 04:37:50 +0900, Sean O'Dell wrote: > On Wednesday 19 November 2003 11:05 am, Yukihiro Matsumoto wrote: >> 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. This argument is circular. > 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. Static typing in Ruby carries too high a performance price, because *everything* (including class and method definitions) are executed at runtime. Far better to have an interface publication mechanism than static -- or "strong" typing. -austin -- austin ziegler * austin@halostatue.ca * Toronto, ON, Canada software designer * pragmatic programmer * 2003.11.19 * 16.05.20