TextIO.scanStream problems
Stephen Weeks
MLton@sourcelight.com
Fri, 29 Sep 2000 10:50:38 -0700 (PDT)
> We knew that this was how scanStream worked: until the reader returns, the
> initial state is kept alive, and it is only dead then if the reader returns
> SOME _ and no one else is holding on to it.
I had never realized that. I think it's horrible to the point of unusability
(as if the speed problems weren't already enough).
> I thought we had already
> discussed an implementation which was way way cheaper: the state consists of
> a buffer and an offset. Each buffer contains a ref which points to either
> the next buffer or the end of the line (the latter including the actual
> things you need to do I/O). Thus you will keep the linked list of buffers
> around, but that is cheap space wise. I.e., the space kept alive is 1 byte
> per char, the absolute minimum.
I don't remember discussing it. Anyways, that's what I'm now implementing.