From: kwatch Date: 2008-09-17T00:12:43+09:00 Subject: Re: Q: IO.read() and IO.write() Thank you, Robert. # sorry for my poor English. 2007/09/16, Robert Klemme wrote: > > 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. * It is possible to read N bytes from the end of file, but IO.read() doesn't support it. Nobody wants File.write() to have all features that File.open() can do. IMO, appending data at the endo of file is not so much. Most of the cases to write data into file is replacing content of that file. So File.write() is useful for most of the cases and you can use File.open(..) {...} when you want to do more complex operation. * File.write() is not the only method that is dangerous. For example, File.unlink() is as dangerous as File.write(). File.unlink() is already provided, you know. > And creating the file for reading does not make sense either. > So, as you can see, read and write as such are quite asymmetric. Why can the assymmetricity of characteristics be the reason of not-to-provide IO.write() ? File.read() and File.write() may be assymmetric in the point of each characteristics, but to provide both methods is symmetric in the point of Ruby's feature. > IIRC Matz said > something similar quite a while ago; you may able to dig that up in the > archives. Thank you for good advice. I'll search it. -- regards, makoto kuwata