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

Re: [Scheme-reports] procedure identity

2013/6/8 John Cowan <cowan@x>
Andy Wingo scripsit:

> For implementations with flat closures, you compare the code pointer and
> each captured variable.  (Mutated variables are captured in a box.)

They don't have to be: in Rabbit they were not, and the compiler kept
track of which closure a mutable variable was actually in.

I'm not entirely sure what that means, but it doesn't sound right.  From ftp://publications.ai.mit.edu/ai-publications/pdf/AITR-474.pdf:

"For the sake of simplicity, RABBIT chooses to generate code which represents environments simply as a list of variable values.  Several environment lists may share a common tail.  The environment for a closure need not contain any variables not needed by the closed function, but it may if this will allow the sharing of a single structure among several closures.  (There is a problem with variables modified by ASET' which is discussed in the next paragraph.)

... To assure consistency, this third set [of variables modified by ASET'] is computed, and such variables must at runtime be placed in an environment structure to be shared by all others which refer to such variables."

These are not what is normally meant by 'flat closures', but if you think they are, then *every* variable is boxed in a car.  In any case, Andy's not wrong.
Scheme-reports mailing list