From: Mathieu Bouchard Date: 2001-08-12T13:59:34+09:00 Subject: [ruby-talk:19573] Re: Ruby as opposed to Python? On Tue, 31 Jul 2001, Paul Prescod wrote: > Mathieu Bouchard wrote: > > Well, if a programmer never-ever declares anything, he gets a result that > > goes with his effort. A lot of declarations may be dead weight, but if you > > use an empty module called FileP (or FileInterface) and include it into > > all File-compatible classes, then you can add write3lines easily like > > this, by reusing your interface module as a mixin module: > > This style is possible in both Python and Ruby but it hasn't caught on > in the Python world. > I think that the conceptual problem is that FileInterface really needs > to be broken down into ReadFile and WriteFile. It is a conceptual problem indeed; but it isn't critical to solve it; BUT it would be a great thing to solve. :-) > And then SeekableReadFile, NonSeekableReadFile, > SeekableWriteFile and NonSeekableWriteFile. This doesn't follow. You need not create all possible interface combinations, you need only: Readable Writable Seekable The seek-cursor attribute :pos is shared by both the reading and the writing interface, so you really need only one interface for this one. (note: if you want to check types and the engine for that only allows checking for one interface at a time, *then* you have to create all possible interface combinations, but usually it simply ends up with short statements like: interface FooAndBar implements Foo, Bar {}) There are irregularities, like how do you handle the flavours of #open and #close, but there are mostly regularities, so it is possible to make sense of it all in general, and perform an effective and meaningful split. Contact me (in private) if you'd like to work on this. matju