[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] valid implementation of call-with-input-file?

Daniel Krueger scripsit:

> I wonder if it would be the simplest way to specify that the file is
> only and always open in the procedure passed to call-with-input-file.
> So an implementation would close the file upon exit (regardless which
> one) of the procedure, saving the state so that upon reentrance of the
> procedure the file would be reopened and restored to the state on exit
> (so seek to the old position etc.) using dynamic-wind.

This is not always possible: some files aren't seekable; some may not
even be reopenable, if they have been deleted while open (not possible
on Windows, but possible on Posix systems).

> In fact, this also applies partially to call/cc, which is in some
> implementations also more of a hack involving stack-copying, isn't it?

Some implementations, but by no means all.  It's also possible to keep
procedure activations in the heap, or to use Cheney on the MTA.

> This is not the fault of the standard, but a problem of the
> implementations of other programming languages (having some
> restrictions) which force the implementors to do these hacks in order
> to interact with these languages.

Nevertheless, the standard can't just ignore implementation barriers.

Using RELAX NG compact syntax to        John Cowan <cowan@x>
develop schemas is one of the simple    http://www.ccil.org/~cowan
pleasures in life....
        --Jeni Tennison                 <cowan@x>

Scheme-reports mailing list