[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: duck-typing allows deeper polymorphism

Devin Mullins

6/10/2005 2:22:00 PM

> 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).

> note that this could be parsed via rdoc quite easily.
Only if it's an Array literal being passed to parseargs.

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). 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.

Once I formulate all my thoughts, I'll probably make an "Enterprise Ruby?" email or something, but for now, all you get is little nits.

Devin




1 Answer

Ara.T.Howard

6/10/2005 2:57:00 PM

0