From: Gavin Sinclair Date: 2004-05-04T21:49:12+09:00 Subject: Re: IO::write On Tuesday, May 4, 2004, 6:42:35 PM, Yukihiro wrote: > Hi, > In message "IO::write" > on 04/05/04, Charles Comstock writes: > |Why is there only an IO::read, and no equivalent IO::write that takes a > |filename, a string to write, and an optional offset in the file to start > |writing at? Or better yet an IO::write(filename[,offset])= string to > |write to file. I don't know it seems useful to me for quickly writing a > |response out to a file anyone else? > IO::read is a equivalent of > > IO::open(path, "r"){|f| f.read(*args)} > > But IO::write that is > > IO::open(path, "w"){|f| f.write(*args)} > > is, for my eyes, useless for most of the cases. You've stated in the past that you don't see much need for a "write at once" operation like the above. I've needed it several times in the past and believe I'll need it several times in the future. > Besides that, I don't feel it is intuitive that IO::write to "open, > then write once, then close". Even if we decide to implement the > method, we should prepare better name. It's *very* intuitive to me, simply because IO.write is acting exactly the opposite to IO.read. I don't see what else a method named IO.write could do. # Well, IO.read and IO.write should probably be methods on File, not # IO, but that's not the point. Cheers, Gavin