From: "Ara.T.Howard" Date: 2004-06-20T05:43:19+09:00 Subject: Re: [RCR] IO#readn On Sat, 19 Jun 2004, Reimer Behrends wrote: > Sean O'Dell (sean@celsoft.com) wrote: > [...] >> I agree, a method called to read n bytes should raise an exception when it >> cannot. > > Except that the semantics of read() specify that _at most_ n bytes will > be read. There are important cases where you want these semantics, such > as when reading from a non-blocking socket or pipe or when reading a > file in chunks without wanting to bother to find out what exactly the > size of the last chunk will be (which can be impossible if the file is > not seekable). > > Reimer Behrends exactly. if don't like the way it works now, try writing code which reads from network socket using a read(n) which throws exceptions. THAT will be ugly... -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | A flower falls, even though we love it; and a weed grows, even though we do | not love it. --Dogen ===============================================================================