From: Simon Strandgaard Date: 2004-05-21T07:16:52+09:00 Subject: Re: Files ugly clone Robert Klemme wrote: > "Simon Strandgaard" schrieb im Newsbeitrag > news:20040520180647.57559b82.neoneye@adslhome.dk... > > > > Solved, just discovered that #dup clones, but without > > cloning the position. Shouldn't #dup clone the file position, > > rather than leaving it as garbage ? > > Probably. OTOH hand I view file positions as tentative: you have to re-seek > anyway if you want to change from reading to writing or vice versa and in > some other situations I believe. Yes the file concept is in general old.. it has some oddities. Accessing files as iterators are a more modern approach. But thats another story. What really took me long time today was that I thought File#dup was broken and didn't performed clone.. then it took me half another hour to come up with the other idea f1.clone.reopen(f1), which just were ugly. Finally I discovered that all this confusion were caused because #dup did not copy the file-position and that I have to re-seek afterwards. What would be nice if make #dup would copy the file-position. Otherwise add a few pages to RI about File#dup, that you have to do the seek manually afterwards. Am I the only one which is frustrated about this ??? -- Simon Strandgaard