[racket-dev] `letrec' and continuations

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Fri May 20 16:59:59 EDT 2011

On Fri, May 20, 2011 at 3:39 PM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
> Let me make my proposals (2 and 3) more precise because your response suggests they were too short.
> 1. We could make internal define the primary vehicle for definitions, i.e., not compile thru letrec. As far as I am concerned, your change to the language to allow defines in many more places has made letrec superfluous.
> 2. The semantics for internal defines would be more Algol like, meaning your example would immediately behave like let and thus be fast.
> 3. As far as letrec is concerned, we can make it 'expensive' if it is no longer the intermediate target instruction from the macro compiler's perspective.
> -- I think my preferred solution would be to wrap letrec so that continuations grabbed during the setup set up a continuation mark that labels them as 'dangerous'. When you reinvoke them, the existence of the mark tells you that the reference cells should be reinitialized (probably only the ones on the control flow from the continuation point).

Why do you prefer this to putting a prompt around the rhs of each
letrec binding?


Posted on the dev mailing list.