On Tue, 22 Apr 2003, Brian Candler wrote:

> What's not clear to me is why IO has a class method which is able to open
> files by name. There is no IO.open so why is there IO.readlines? But I see
> there is IO.reopen. Hmm, the division of responsibility between IO and File
> seems a bit blurred to me...

java has a very non-blurry class division amongst it's io classes and this is,
IHMO, simply pure evil.

there are alot of things in ruby which, although they may not follow perfect
00 desgin, do follow POLS (relative to other languages!).

take IO.readlines() for instance, now that you mention it, it is an odd method
that may belong in File only, but isn't IO file based 95% of the time?
perhaps this was the rational...  in any case, it seems like a tiny example of
virtual inheritence - where the parent knows of it's children, and delgates to
one where it sees fit.  the more object oriented programming i do, the more
have come to dislike inheritence in the general case;  this is a good example
of why inheritence is not good for OO :

  * File knows about the internals of IO, breaking encapsulation
  * IO knows of it's children, breaking encapsulation

anyways, i would NOT like to see a *very* clear division of responsibility in
ruby's io classes  if it meant they ended up being closer to java's.  yuck ;-)

-a

btw:  i'm not neither agreeing or disagreeing with you - just thought i'd
throw that out there



--
  ====================================
  | Ara Howard
  | NOAA Forecast Systems Laboratory
  | Information and Technology Services
  | Data Systems Group
  | R/FST 325 Broadway
  | Boulder, CO 80305-3328
  | Email: ara.t.howard / fsl.noaa.gov
  | Phone:  303-497-7238
  | Fax:    303-497-7259
  ====================================