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

Re: critical problems with call---file, with---file



                               ...For example, if I write:
      (with-input-from-file "foo.in"
         (letrec ((loop (lambda ()
                           (write-char (read-char))
                           (loop))))
            loop)),
    it is clear that a clever Scheme system can prove that the thunk
    will never return; however, it would be entirely inappropriate to
    close the new default port and restore the old.

Nice example.  Should we say instead that "If the procedure does not
return, Scheme will not close the port unless it can prove that the
continuation with which the procedure was called has become
inaccessible"?

I can't get very excited if ports aren't closed the instant they become
inaccessible, because I suspect that pairs aren't added to the free list
the instant they become inaccessible either.  I can't see how it affects
my life.

As I read the report, implementations are not required to try to close
ports in the exceptional cases.  Likewise, though implementations are
"permitted to reclaim the storage occupied by an object if they can
prove that the object cannot possibly matter to any future computation",
I don't see where implementations are actually required to reclaim
storage.  I think it's clear that implementations are encouraged to do
both, and it's great that Chez Scheme is setting such a good example for
us to follow.

It would be reasonable to say that "in order to avoid running out of
file-system resources, implementations usually close ports it can
prove are inaccessible" if it were true.  Is it?

Implementation note:  In a very large multiprocessing implementation of
Scheme it might be more practical to remove limits on file-system
resources than to determine whether ports are accessible.

----------------------------------------------------------------
The section that describes differences between RRRS and R3RS should
note that (DEFINE (FOO ...) ...) is now equivalent to
(DEFINE FOO (LAMBDA (...) ...)) instead of to
(DEFINE FOO (REC FOO (LAMBDA (...) ...))).

Peace, Will