
sorawee
2021-10-16 17:02:28
Let’s suppose that the only operations that we will perform on a hash table are hash-ref
and hash-set!
, and none of the keys is interned. Let’s even suppose that hash table values are totally disjoint from the keys. Can’t hasheq
always be replaced with weak-hasheq
?
The reasoning is as follows: it’s impossible to construct the key again. So that key-value entry is already lost. We might as well garbage collect it.

laurent.orseau
2021-10-16 17:15:21
Is the question whether this is a legitimate use of weak-hasheq?

sorawee
2021-10-16 17:18:22
Not really. I do think it’s a legitimate use (but correct me if I’m wrong), but I want to know if it’s always safe to do so

laurent.orseau
2021-10-16 17:51:13
The difference is too subtle to me :slightly_smiling_face: Can it be legitimate but unsafe?

samth
2021-10-17 00:14:32
What do you mean by the keys not being interned?