From: Bill Kelly Date: 2006-04-03T03:39:08+09:00 Subject: Re: Typed Parameters From: "Trans" > > 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? I don't see why you would need to bear the burden of worrying about this. Let it be my problem, if I feel the need to use your library in a way you hadn't anticipated. :) > 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? Hmm... This is starting to remind me of public vs. private methods. Ruby lets me call a private method on one of your classes, but I have to do so explicitly - and if your class internals change later on and my call to that private method breaks, I won't be surprised. I took the risk deliberately. Maybe if parameter types could be specified and enforced in some way where I, the library user, would have a means of calling the method that would bypass those checks? So that, most of the time, I pass in an Integer and everyone's happy. But if I decide that passing in a Watchamacallit best meets my needs, then there should be a way to call your method and bypass the type checks - even if I have to be explicit about it. I guess what I'm saying is IF there were typed parameters, I think there should be a way around the checks, similar to how we can call private methods when we really need to. Regards, Bill