From: dblack@... Date: 2006-04-02T20:51:25+09:00 Subject: Re: Typed Parameters Hi -- On Sun, 2 Apr 2006, Trans wrote: > > dblack@wobblini.net wrote: >> Hi -- >> >> On Sun, 2 Apr 2006, Trans wrote: >> >>>
>>> It's not actually that practical, and such things end up making your >>> code very much like C++ and Java. >>> >>> Ruby is smarter than that. Ruby can do more than that. >>> >>> Think in terms of what your object's required capabilities are instead >>> of pretending that a class indicator is sufficient for that. >>>>>> >>> While I understand you pointr Austin --obviously where talking Duck >>> Typing here. But I think it is interesting to condier that this is some >>> respect antithetical to OOP in general --I mean the reciever _is_ a >>> specific type. And that reacieve detemine the functionality of the >>> method call. It is sort of as if you were progamming in a more >>> traditional functional language and _had_ to specifiy the type of the >>> first argument, but never the remaining. >>> >>> foofunc( FooClass foo, clever, smart, stupid ) >>> >>> instead of >>> >>> foo.foofunc( clever, smart, stupid ) >> >> It's actually more like this: >> >> foofunc(object_that_responds_to_foofunc, etc.) >> >> The fact that an object handles a message does not imply its class. >> (I'm transliterating 'type' to 'class' as that seems to be what the >> thread is actually about [as it usually is :-].) > > But the class of that object dictates the functionality of that > message. That's my point --it's class based. A double dispath makes > this very clear: No: the definition of the method dictates the functionality of the method. That can vary from one instance to another, even within a class. It often doesn't; but because it *can*, one can view the case where two instances of a class behave the same way as a special case of the case where they don't. David -- David A. Black (dblack@wobblini.net) Ruby Power and Light, LLC (http://www.rubypowerandlight.com) "Ruby for Rails" chapters now available from Manning Early Access Program! http://www.manning.com/books/black