[Top][All Lists]

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

Re: continuation?

From: Matthias Koeppe
Subject: Re: continuation?
Date: Mon, 26 May 2003 11:44:16 +0200
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.3.50 (sparc-sun-solaris2.8)

Bill Schottstaedt <address@hidden> writes:

> Why doesn't Scheme have "continuation?"?  

A continuation is just a procedure.  It is not guaranteed to be
distinguishable from an "ordinary" procedure.  

A Scheme compiler can transform programs that use
call-with-current-continuation in a way that just "ordinary"
procedures are passed, i.e. no magic "continuation object" occurs.

Therefore, a program should not depend on this distinction.

> (catch 'got-c-g
>  (lambda ()
>    (do ((i 0 (1+ i)))
>        ((= i 100))
>      (if (c-g?) ; returns #t if C-g was typed
>        (call-with-current-continuation
>         (lambda (return)
>           (throw 'got-c-g return))))
>      (display (format #f "back again: ~A" i))
>      (sleep 1)))
>  (lambda args
>    (display (format #f "caught C-g: ~A" args))
>    (if (continuation? (cadr args))

          ^^^^^^^^^^^^^ procedure?

>        ((cadr args) #f))))

Matthias Koeppe --

reply via email to

[Prev in Thread] Current Thread [Next in Thread]