chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Fix #1620 by ignoring captured state of re


From: John Cowan
Subject: Re: [Chicken-hackers] [PATCH] Fix #1620 by ignoring captured state of replaced variables
Date: Sun, 30 Jun 2019 11:33:17 -0400



On Sun, Jun 30, 2019 at 9:57 AM Peter Bex <address@hidden> wrote:

Captured simply means that it needs to be wrapped up in the closure,
AFAIK.  But if it's replaced, then the original variable will need
to end up in the closure.  The only case where you can't replace is
if either variable is assigned to, because then they don't point to
the same thing anymore.

Obviously this is not something you can do in a patch,
but at some point Chicken may want to go
over to the assignment conversion strategy, in which all mutable
local variables are transformed into immutable references to boxes.

When the original code uses such a variable, it becomes a
call on box-ref, and a set! of such a variable becomes a call
on box-set!  Eventually the box will be reclaimed by the
garbage collector.  Local mutable variables are rare enough
that this does not create significant memory pressure.

Chez and perhaps other compilers use this transformation because
of how much it simplifies bookkeeping.  In ML, it's actually exposed
to the programmer, and the *only* mutable thing are boxes ("refs")
and mutable arrays.  But of course ML is not Scheme.


John Cowan          http://vrici.lojban.org/~cowan        address@hidden
The experiences of the past show that there has always been a discrepancy
between plans and performance.        --Emperor Hirohito, August 1945


reply via email to

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