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

Firstclass continuations

    Date: Mon, 23 May 88 22:55:49 edt
    From: jinx at CHAMARTIN.AI.MIT.EDU (Guillermo J. Rozas)

    MIT Scheme has a procedure (rather than a special form) called
    DYNAMIC-WIND, which is a generalization of UNWIND-PROTECT.

     (lambda () <entry>)
     (lambda () <body>)
     (lambda () <exit>))

    is similar to

      (let ((val <body>))

    except that <exit> is executed whenever <body> is "escaped", and
    <entry> is executed whenever <body> is (re)entered.

T has this too; it's called BIND-HANDLER, and behaves the same way.
(UNWIND-PROTECT body . exit) is sugar for (BIND-HANDLER FALSE (LAMBDA ()
body) (LAMBDA () . exit)).  The BIND macro is also sugar for a use of
BIND-HANDLER, thus the name.