working SML/NJ version of MLton.Socket

Stephen Weeks MLton@sourcelight.com
Mon, 17 Dec 2001 12:05:41 -0800


> I'm pretty sure I remember some mail between you and I thought Reppy about if
> there was a way to make TextIO.instream or TextIO.outstream tied  to  a  file
> descriptor one already has (say at process start up).  I searched through all
> my saved mail and could not find it.  Without it I don't see a  sane  way  to
> duplicate the functionality of MLton.Socket.  (The only way I can think of is
> to  look  in  /proc/self/fd,  then  open  /dev/null,  then  look   again   in
> /proc/self/fd,  then dup the file descriptor of the socket connection over to
> that of the /dev/null you just opened.)

Have a look at lib/mlton-stubs-in-smlnj/mlton.sml, the
MLton.TextIO.newIn function.  I think that distills the email
conversation with Reppy.