From: Trans Date: 2006-04-03T02:13:44+09:00 Subject: Re: Typed Parameters [David] 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] A fair point althouhg not exactly true. When you define a singleton method you are quite literally giving an object a new Class, the original of which becomes the superclass of the new one. One assumes of course, as we all do and must, that a subclass essentially obeys the same contract as it's anscestor. Not that it has to of course, but in general we must in order to gain from the whole OOP methodology. A String and an Integer, for instance, are very different things. So when I specify a parameter should be an an Integer, say, I mean that it should be quite like one of those things, so much so that it should be a sublcass of it or have a coercability for becoming so, otherwise don't waste time trying. Just b/c some other object might repsond to all the same methods I end up using doesn't mean much --poeple just don't think that way. I've creted my method to deal with Integer's that's what I designed it to do. You want to send it a Watchamacallit? Why? You really think it's going to work? Do you know enough about the method I wrote to think that using it with Watchamcallit's will be all that beneficial? If a Watchamacallit isn't Integery enough to be a subclass of one or be coerced into one, what makes you think it SHOULD work? What if you change Watchamacallit later on? What if my mehtod changes later on? Integer's not likely to change that's what I'm depending on. This Integer contract may not be perfect, but it relative dependency is intrumental to the construction of my software. There are no gaurantee's whatsoever for Watchamacallits. I think duck typing is great and all, but it's one of those things that plays better in theory than it actually does in practice. T.