Suitable values as weak keys Marc Nieper-Wißkirchen (12 Sep 2024 15:14 UTC)
Re: Suitable values as weak keys Daphne Preston-Kendal (18 Sep 2024 15:07 UTC)
Re: Suitable values as weak keys Marc Nieper-Wißkirchen (18 Sep 2024 15:25 UTC)
Re: Suitable values as weak keys Daphne Preston-Kendal (22 Sep 2024 10:08 UTC)
Re: Suitable values as weak keys Marc Nieper-Wißkirchen (22 Sep 2024 10:12 UTC)
Re: Suitable values as weak keys Daphne Preston-Kendal (22 Sep 2024 10:36 UTC)
Re: Suitable values as weak keys Marc Nieper-Wißkirchen (22 Sep 2024 11:42 UTC)
Re: Suitable values as weak keys Daphne Preston-Kendal (22 Sep 2024 11:55 UTC)
Re: Suitable values as weak keys Marc Nieper-Wißkirchen (22 Sep 2024 12:02 UTC)
Re: Suitable values as weak keys Daphne Preston-Kendal (22 Sep 2024 12:05 UTC)
Re: Suitable values as weak keys Marc Nieper-Wißkirchen (22 Sep 2024 12:56 UTC)
Re: Suitable values as weak keys Daphne Preston-Kendal (23 Sep 2024 09:38 UTC)
Re: Suitable values as weak keys Marc Nieper-Wißkirchen (23 Sep 2024 10:13 UTC)
Re: Suitable values as weak keys Daphne Preston-Kendal (23 Sep 2024 10:19 UTC)
Re: Suitable values as weak keys Marc Nieper-Wißkirchen (23 Sep 2024 10:59 UTC)
Re: Suitable values as weak keys Marc Nieper-Wißkirchen (23 Sep 2024 12:42 UTC)

Re: Suitable values as weak keys Daphne Preston-Kendal 18 Sep 2024 15:06 UTC

Marcā likhitaḥ:

> The existing SRFIs 124 and 246 do not say anything about which Scheme
> values are suitable as ephemeron keys and as elements of a guardian.
>
> For example, in Chez Scheme, an ephemeron with a fixnum key is never
> broken; an ephemeron with a bignum key can. (This reflects the
> delicate behaviour of eq? on numbers in Scheme.)
>
> One possible solution is to disallow values which do not refer to
> locations as weak keys.

I see the sample implementation currently does this.

I think it is probably a bad idea, because what has location and what
does not is implementation-dependent – beyond matters which, in R6 and
in the Large language, are easy to detect, such as fixnum range. Some
implementations store symbols with short names as immediates to relieve
GC pressure. Some implementations don’t have characters as immediates.
Some implementations have a single ‘empty string’ value. (You can
imagine someone maintaining an ephemeron table mapping strings to
some kind of property, even using string->symbol to intern them, and an
empty or very short string ending up in the table.)

I proposed a ‘has-location?’ primitive a while ago, exactly for the
purpose of detecting whether it makes sense to put something in an
ephemeron or a guardian, and John Cowan rejected it for basically these
reasons. (Alas, I don’t remember where: it might have been in a private
conversation with him.)

--
dpk (Daphne Preston-Kendal) ·· 12103 Berlin, Germany ·· http://dpk.io/
The people’s flag is palest pink, | Don’t let the scarlet banner float;
It’s not as red as most think.    | We want the middle classes’ vote.
We must not let the people know   | Let our old fashioned comrades sneer
What socialists thought long ago. | We’ll stay in power for many a year.