From: Robert Klemme Date: 2008-09-16T01:42:55+09:00 Subject: Re: Q: IO.read() and IO.write() On 15.09.2008 15:14, kwatch wrote: > Thank you for everyone who replied me. You're welcome. > On 2008/9/5 Robert Klemme wrote: >> Why don't you just create a library of things you regularly need and >> require that? > > It is one solution, but not answer for my question. I could have put it differently: why bother when there's an easy solution that does not require the answer to the original question? Curiosity is good, but sometimes it distracts from getting solutions. That may sound harsh; I guess I've become a bit grumpy because of all the "why is X?" and "can't we make Y?" type of questions. It seems with the growing number of users there is also a significant growth in "change requests". Unfortunately a lot of them seem not well thought out or are about things where there are solutions that do not need a language / core library change. >>> It is easy to define File.write() but I hope it is provided by Ruby. >> Probably because writing is more dangerous and also there are more >> options to file writing than to read (beginning vs. at end, create or >> not, text vs. binary). > > Your points apply to IO.read() as well as IO.write(). > IO.read() is provided in default regardless it doesn't support binary > mode. Not really: reading is not dangerous because it cannot destroy the file. There is no point in starting to read at the end of the file. And creating the file for reading does not make sense either. So, as you can see, read and write as such are quite asymmetric. IIRC Matz said something similar quite a while ago; you may able to dig that up in the archives. Cheers robert