Lucas Dixon wrote:
Perhaps this is something to do with my failure to understand unix pipes, but the following confuses me...
However, the following misbehaves:

echo 'fun loopy () =
    let val sopt = TextIO.inputLine(TextIO.stdIn);
    in case sopt of SOME s => (print s; loopy ())
                      | NONE => ()
        end;
PolyML.export ("foo", loopy);
OS.Process.exit OS.Process.success;' | poly

Somehow the "OS.Process.exit OS.Process.success;" becomes the first input whenever I foo...


Lucas,
No, this was a bug. Thanks for letting me know and I've installed a fix in CVS. What was happening was that buffered but unread input was being written out by PolyML.export and then supplied as input to foo. When used interactively each line is processed separately so the buffer was empty but when read from a file or a pipe the "OS.Process.exit" line was in the buffer. The fix clears the buffer at start-up.

Regards,
David.

_______________________________________________
polyml mailing list
polyml@inf.ed.ac.uk
http://lists.inf.ed.ac.uk/mailman/listinfo/polyml

Reply via email to