From: Sean O'Dell Date: 2003-11-20T06:48:16+09:00 Subject: Re: "stereotyping" (was: Re: Strong Typing (Re: Managing metadata about attribute types) On Wednesday 19 November 2003 01:38 pm, Yukihiro Matsumoto wrote: > Hi, > > In message "Re: "stereotyping" (was: Re: Strong Typing (Re: Managing > metadata about attribute types)" > > on 03/11/20, "Sean O'Dell" writes: > |> library is requiring Socket interface, but without that kind of > |> interface check, no flexibility is lost, it's little bit hard to find > |> out the semantics. > | > |When a method is written to use the methods of another object, and that > | code is distributed as a library, the function of that method is fixed. > | You must pass it an object that has the methods it requires, and those > | methods must take the exact parameters it expects. > | > |The flexibility to change the method of the object is lost. You cannot > | change the parameters to the "send" method of a Socket object and pass it > | to a library that uses it. You will get an error deep inside the > | library. > > I don't understand "the flexibility to change the method of the > object". What is that? I think it has never existed before. > We cannot lose something that has never existed. Right now, if I inherit the File object, I can re-define the #read method to do something other than just read (perhaps log the read action somewhere). If I don't change the parameters, I can pass the object to other the methods of other classes that want a File object, and they can call obj.read safely. However, if I change the parameters that #read takes, I can no longer pass that object to those methods. I don't have that flexibility. If I want to pass my object, I must leave the parameters of #read the same > |> |Reconsider, Matz. > |> > |> Reconsider what? I didn't tell you any decision yet. I'm still > |> the level of seeking what you mean. > | > |You said the following: > |> I admit type checking can gain you something, at the cost of > |> flexibility, which I don't want to pay in Ruby. > | > |You don't want to pay the price of type checking in Ruby. My version of > | it is really "interface checking," but either way what you said sounds > | like you've decided you don't want to pay the price for any of this. > > You've misunderstood me. I don't want to pay "the cost of losing > flexibility", that means I don't want to make any change hindersc > "my" flexibility, which can be harmed by "type checking based on > inheritance". Since your "interface checking" do not affect > "flexibility" in bad manner, I said nothing against it. You don't lose flexibility at all. Your flexibility is exactly the same. Here, I'm going to go write an RCR and let's talk about it, I have the feeling I'm not being understood at all. Sean O'Dell