From: Thien Vuong Date: 2003-11-21T17:12:17+09:00 Subject: Re: "stereotyping" (was: Re: Strong Typing (Re: Managing metadata about attribute types) ) Sean O'Dell wrote: > On Thursday 20 November 2003 07:58 pm, Yukihiro Matsumoto wrote: > >>At least I need to take time to sit down and read your article >>carefully first. > > > This is, I think, the clearest I can make the new proposal tonight: > > http://www.rubygarden.org/ruby?InterfaceContracts > > Perhaps tomorrow I can clean it up some more, when my eyes don't hurt as much, > and after Ziegler points out how wrong it is and how pointless even trying is > and how it's all just pointy-haired twaddle to be immediately made obsolete > by an eval statement. > > Sean O'Dell > I read it over a bit and have a few comments - Rather have the method definition stay as is (no addition of type declaration). Interface should be an optional enhancement - take a class, add a interface (hopefully short) section, and we have what we need - no fuss (or in Ruby, reopen an existing class, ...). It may be more work to allow interface to be added "after" the method have been defined though. - Rather not have the return type declaration. With dynamic language, I don't know if this could be done without runtime checkin. Also, the check, I think, would also need to be done at the object receiver end (i.e. calling class) and this would involves runtime checkin with the cost to be born by user of object. BTW, thanks much for taking the heat for trying to expose this issue. Don't know where this will lead but it is much better than people get exasperated and quietly leave. I do feel, however, that having interface fully separated from class put an onus on the use of interface (as personally I mostly design the object structure through the interface -i.e. user of objects should not have to care/deal with class - only interfaces). Class is only a convenient expression to support code reuseability through inheritance and polymorphism. But it is also a convenient way of describe interface. Syntactic sugar (simplicity, style) is a desirable feature of Ruby, and making it it inconvenient to use will turn people off from using and we'll be right back to using the same stuff as where we started. Thien