From: Jonathan R. <jon...@gm...> - 2005-11-30 01:19:56
|
Hi, IO.pipe () is broken. Input wraps around, rather than raising No_more_input= . A session from O'Caml: # #load "extLib.cma";; # open IO;; # let (i,o) =3D pipe ();; val i : IO.input =3D <abstr> val o : unit IO.output =3D <abstr> # nwrite o "hello world";; - : unit =3D () # read_all i;; Interrupted. # nread;; - : IO.input -> int -> string =3D <fun> # nread 16 i;; Characters 6-8: nread 16 i;; ^^ This expression has type int but is here used with type IO.input # nread i 16;; - : string =3D "hello worldhello" # nread i 16;; - : string =3D "hello worldhello" # really_nread i 16;; - : string =3D "hello worldhello" # nread i 255;; - : string =3D "hello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhello worldhe" This also means you can't use read_all on an input from pipe(), which is a problem for me. Jonathan |