From: Sean O'Dell Date: 2003-11-20T03:06:18+09:00 Subject: Re: "stereotyping" (was: Re: Strong Typing (Re: Managing metadata about attribute types) ) On Wednesday 19 November 2003 05:09 am, Jim Weirich wrote: > > On Wed, 2003-11-19 at 10:30, Weirich, James wrote: > > [... redesign of Ruby class libraries to support abstract IO objects > elided ...] > > An interesting suggestion, but I still feel it still over constrains the > problem. For example, what if I had an input only device. If I include > the IO module then I am lying about its capabilities, but if I don't > include IO, then I can't use it in functions that read from IO objects. Ruby definitely needs a solid, abstract IO interface. But as to the issue of partially-implemented interfaces, I think they're fine. One IO interface is all you need. If you have an object that is input-only and sequential, and the base IO interface allows for more, then your class is simply not going to implement them. Interfaces don't need to be assumed fully-functional. Just partially implement the interface. Objects of that class simply cannot be passed to functions that do random-access IO or output. Even in strong-typing environments like Java and C++, this happens all the time; as humans, we can deal with it. =) Sean O'Dell