[plt-scheme] reading a whole file

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Nov 14 06:41:37 EST 2008

On Nov 12, Thomas Chust wrote:
> On Nov 11, Eli Barzilay wrote:
> > On Nov 10, Ben Goetter wrote:
> > > Only helpful for byte files, or for those rare text files whose
> > > encoding matches that of PLT Scheme's UCS-4 strings.  I agree,
> > > would certainly address the performance issues mentioned.
> >
> > Another problem is that the memory must be out of the GC's hand,
> > which adds another layer of complication.  Also, I don't see how
> > this kind of a `mutable' byte string is useful -- it's only in
> > rare cases that you need to edit things in-place.
> 
> This may be a small problem, although I doubt it is any problem at
> all for a precise garbage collector. But it is certainly not a
> problem that would be newly introduced: The necessary feature
> already exists in PLT Scheme -- look for make-sized-byte-string in
> the documentation of scheme/foreign.

Yeah, I know about it...  The point is that doing this at the core
means that bytes are a little uniform which can make things a little
more complicated and in this case there's little gain.  But these
problems are not too serious -- which is exactly why it should be easy
to do this at the Scheme level, using the foreign interface.


> As for the mutability: I agree that most of the time you would not
> want to modify the string and even if you wanted to modify the
> string, you would maybe not want the modifications to be written to
> disk. But memory mapping offers all these possibilities through
> combinations of either read or read/write protection and either
> private copy on write or shared mapping. If memory mapping was
> implemented, I think it should be implemented right, with all the
> available features.

Sounds like a nice project...

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.