In the Dec 2021 update to State of Valhalla, part 2: The language
model, the section on "Identity-sensitive operations" states this
about weak references:
> Weak references to value objects that contain no references to identity
> objects should never be
> cleared; weak references to value object
It certainly seems that all the choices are bad.
The "obvious" choice is to simply say that WeakReference makes no
sense, in that it sidesteps the hard semantics questions. My fear is
that this will cause new failures, where existing libraries that toss
objects into WHMs to cache derived resu
>
> It certainly seems that all the choices are bad.
>
> The "obvious" choice is to simply say that WeakReference makes no
> sense, in that it sidesteps the hard semantics questions.
It's an uncomfortable answer but it seems to provide the most
defensible (and thus understandable) semantics for u
One option is to look at what we can do to help users prepare for IAE
when using value-based classes as keys to WHM. Can we take an
approach similar to JEP 390 [1] and provide JFR events that flag uses
of value-based classes as keys? It's not perfect but similar to JEP
390, it does help users to
- Original Message -
> From: "Dan Heidinga"
> To: "Brian Goetz"
> Cc: "valhalla-spec-experts"
> Sent: Wednesday, February 9, 2022 5:50:29 PM
> Subject: Re: SoV-2: weak references
> One option is to look at what we can do to help users pre
I have come around to a similar conclusion. None of the models for
WR(value) are really all that justifiable, other than "throws". But we
dislike that because so much code uses WHM that we are worried about
this code all of a sudden failing. But we are trying to fix that by
distorting WR, ra
This is not based on a very deep understanding, sorry:
* WeakReference, 1-arg constructor: When given a bucket 2-or-3 instance, it
seems maybe fine to just treat as strong reference? User is saying "just
hold this loosely, don't keep it alive on my account" and doesn't care what
happens after that
On 2/9/2022 1:23 PM, Kevin Bourrillion wrote:
This is not based on a very deep understanding, sorry:
* WeakReference, 1-arg constructor: When given a bucket 2-or-3
instance, it seems maybe fine to just treat as strong reference? User
is saying "just hold this loosely, don't keep it alive on
> * For WeakHashMap use cases, I would expect that any attempts to actually
> design something "good" that does what users really "want" would end up at
> some different library entirely. This is something that Caffeine probably
> does well (disclosure, I worked on the thing that became that).
>