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

Re: Topes

Aubrey, in your letter dated Wed, 5 May 93 21:11:37 -0400, you wrote:
>       But *is* there a way to catch a continuation that does not point back
>       to the file?
>If you want to do this entirely from the file being loaded, it is not
>possible in a way that is guaranteed to work in all R4RS compliant
>But you could redefine LOAD to dynamically bind a variable, say
>*load-continuation* to the LOAD's continuation.
>(define *load-continuation* #f)
>(define load
>  (let ((load load))
>    (lambda (file)
>      (call-with-current-continuation
>       (lambda (cont)
>	 (let* ((swap-lc (lambda ()
>			   (define old-lc *load-continuation*)
>			   (set! *load-continuation* cont)
>			   (set! cont old-lc))))
>	   (dynamic-wind
>	    swap-lc
>	    (lambda () (load file))
>	    swap-lc)))))))

Yes, of course.  But this would have to be done *before* the file loads, so
a package that is to be distributed cannot assume this has happened.

If there were selectors defined on continuations (or functions in general),
I could "cdr" down the current continuation till I passed "load".
[And why not?  The constructor is trivial:
      (lambda ((f g) arg) (f (g arg)))
- but this is turning into *very* vague dreaming!].

Since this was needed to hack a simple error handling system, I suppose
requiring the existence of some procedure "error" might be the way to go.

Anyway, that's not really what I'm interested in (though I greatly
appreciate your reactions!) - this was only a side issue,.

What I'm really curious about, is arguments not to add topes to Scheme.
I know one: it's a change.  Are there others?