From: Simon Strandgaard Date: 2004-05-21T07:19:25+09:00 Subject: Re: [rcr] make File#dup intuitive daz wrote: > Simon Strandgaard wrote: > > > > position is not copied.. try this example for yourself > > > > f1 = File.open(__FILE__, 'r') > > f1.seek(5) > > p f1.pos # -> 5 > > f2 = f1.dup > > p f2.pos # -> garbage > > > > server> ruby a.rb > > 5 > > 93 > > server> > > > > This is really non-intuitive that you have to do > > a seek afterwards. Its the same as if you clone a string, > > but have to copy the string-content yourself. > > Where is logic here? > > > > Works here. > # ruby 1.9.0 (2004-04-27) [i586-bccwin32] > # ruby 1.8.0 (2003-05-15) [i386-mswin32] > # ruby 1.6.7 (2002-03-01) [i586-mswin32] > > mainframe_19(north_garage)> ruby pos.rb > 5 > 5 > mainframe_19(north_garage)> Hmm.. this begins to look like a freebsd specific problem. server> ruby -v a.rb ruby 1.9.0 (2004-05-17) [i386-freebsd5.1] 5 93 server> ruby18 -v a.rb ruby 1.8.1 (2003-12-22) [i386-freebsd5.1] 5 93 server> -- Simon Strandgaard