From: Marek Janukowicz Date: 2004-05-20T00:18:47+09:00 Subject: Re: How to duck type? - the psychology of static typing in Ruby On Tue, 18 May 2004 11:20:30 +0200, Robert Klemme wrote: >> In other words, this feature would be equivalent of 'strongtyping' >> library, just with better syntax and compile-time checking (to avoid >> runtime overhead). > > But there's a whole lot of problems waiting: > > - You need return type declarations (at least optional) You're right. > - What do you do if you invoke a method with a required parameter type bu > t your value resides in some typeless var? Good point - that's the question I didn't reconsider. > - You'll likely and up casting values all the time => errors here can > only be detected at runtime You may be right here too :) > - Internal handling of references must be completele changed. I do not (yet) think about consequences for Ruby interpreter. > - What do you gain by type info if any instance is free to override > methods defined in the class at will? How often do your instances override methods defined in class? You're right - type info would not help in this case, but most programs do not do this. > Although I can see the benefit for some users, I'm still not convinced > that this is a good idea, that it fits Ruby well and / or that this will > show up in Ruby in the near future. I'm not convinced too - that why I am presenting my idea here. Thanks very much for your thoughts - they gave me much broader view of the whole problem. -- Marek Janukowicz