Re: SRFI 254, as written, is incompatible with generational gc
Will Clinger 03 Dec 2026 21:18 UTC
On Thu, Dec 3, 2026, at 10:48 AM, Daphne Preston-Kendal wrote:
> On 3 Dec 2026, at 17:38, Will Clinger <xxxxxx@larcenists.org> wrote:
>
>> I propose we add a post-finalization note that says the second
>> condition quoted above should either be ignored or, if not
>> simply ignored, should be interpreted in some way that allows
>> implementations that rely upon generational collectors (whether
>> younger-first or otherwise) to support SRFI 254.
>
> How would we then address the problem noted in my original mails, of
> creating a hash value representing the locations of multiple objects?
If you want your hash function to be based upon the locations of
multiple objects, you should write your hash function to make it
a function of the locations of all of those objects.
If you want to be informed whenever any of those objects move,
you should register all of those objects with a transport-cell-guardian.
If you write your hash function in such a way that it depends upon
the stipulated second condition of SRFI 254, then you will not get
the behavior you expect in systems that use a generational garbage
collector, because (to my knowledge) none of the moving garbage
collectors in use today by implementations of Scheme can guarantee
the stipulated second condition will hold. If you need proof of that
fact, I can write a short test program that demonstrates the failure of
that stipulation in Larceny; that program necessarily uses some
implementation-dependent features to reveal the problem (because
it has to know how to obtain the location of an object and it has to
be able to force certain kinds of garbage collection to occur), but
it should not be difficult to translate that test program into code for
Chez Scheme that demonstrates the problem there as well.
Will