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) = pipe ();;
val i : IO.input = <abstr>
val o : unit IO.output = <abstr>
# nwrite o "hello world";;
- : unit = ()
# read_all i;;
Interrupted.
# nread;;
- : IO.input -> int -> string = <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 = "hello worldhello"
# nread i 16;;
- : string = "hello worldhello"
# really_nread i 16;;
- : string = "hello worldhello"
# nread i 255;;
- : string =
"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
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
|