StringIO <-> File repos after eof discrepancy

Hi,

This discrepancy is anti-POLS for me:

$ ruby -v -rstringio -e 'f = StringIO.new("a\n"); p f.read(2); p
f.read(1); f.pos = 0; p f.read(1)'
ruby 1.8.2 (2004-12-25) [i686-linux]
"a\n"
nil
nil
$ echo a > t
$ ls -al t
-rw-r--r-- 1 feldt users 2 Jan 21 14:55 t
$ ruby -v -e 'f = File.new("t"); p f.read(2); p f.read(1); f.pos = 0;
p f.read(1)'
ruby 1.8.2 (2004-12-25) [i686-linux]
"a\n"
nil
"a"

Best,

Robert

Hi,

ยทยทยท

In message "Re: StringIO <-> File repos after eof discrepancy" on Fri, 21 Jan 2005 23:16:41 +0900, Robert Feldt <robert.feldt@gmail.com> writes:

This discrepancy is anti-POLS for me:

EOF flag should be cleared by StringIO#pos=(). Thank you.

              matz.

Yes (at least if new pos is less than the size?).

Thanks for quick reply,

Robert