From: "Ara.T.Howard" Date: 2005-06-10T23:57:07+09:00 Subject: Re: duck-typing allows deeper polymorphism On Fri, 10 Jun 2005 twifkak@comcast.net wrote: >> this shows, right up front in the method, that the method takes an argument >> 'x' which must respond to 'upcase', and 'downcase'. an exception is thrown >> if something that does not respond to both these methods is passed in: > Not entirely true... The argument 'x' must also respond to whatever > parseargs wants from it (respond_to?, I assume), whatever the 'pa.x' method > wants from it (well, nothing, I assume), and whatever 'p' wants from it > (to_s, I assume). sure - everything in :ducktype=>list AND what parseargs needs - quite true. > >> note that this could be parsed via rdoc quite easily. > Only if it's an Array literal being passed to parseargs. huh? > Ara, I'm not trying to dismiss the effort you put into parseargs, or its > usefulness in pulling off programming by contract (especially in comparison > to the alternatives). oh but you should! ;-) it's marked 'experimental' for at least a couple of reasons and is just an idea i'm throwing out there to see what comes back. for the record: by no means am i suggesting it's a completely baked idea. we're all friends here so i assume people will offer up any criticisms come to mind. > Rather, I'm trying to point out that Ruby's so flexible that it makes it > very difficult to do. I'm not arguing against duck typing -- enough people > have done that already, plus I like it. However, I still have qualms about > using Ruby in the enterprise (read: with a bunch of programmers who aren't > me), and duck typing is one of the reasons why. i can see that. cheers. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | My religion is very simple. My religion is kindness. | --Tenzin Gyatso ===============================================================================