[plt-scheme] reading a whole file

From: Thomas Chust (chust at web.de)
Date: Wed Nov 12 12:25:59 EST 2008

On Nov 11, Eli Barzilay wrote:
> On Nov 10, Ben Goetter wrote:
> > Thomas Chust wrote:
> > > what about adding support for memory mapping to PLT Scheme? This would
> > > allow you to turn a whole file into a mutable or immutable byte string
> > >   
> > 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.

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.

cu,
Thomas


___________________________________________________________________
Kennen Sie schon die Blockbuster-Aktion von WEB.DE?
Jeden Monat 2 Freifilme sichern unter http://www.blockbuster.web.de



Posted on the users mailing list.