[External] Foo / Foo.ref is a backward default; should be Foo.val / Foo

Kevin Bourrillion kevinb at google.com
Wed Apr 27 15:19:30 UTC 2022


On Wed, Apr 27, 2022 at 11:03 AM Dan Smith <daniel.smith at oracle.com> wrote:

> On Apr 26, 2022, at 5:22 PM, Kevin Bourrillion <kevinb at google.com> wrote:
>
> (Thought experiment: if we had an annotation meaning "using the .val type
> is not a great idea for this class and you should get a compile-time
> warning if you do" .... would we really and I mean *really* even need
> bucket 2 at all?)
>
> Yes, because some (many?) class authors want strong guarantees that the
> initial (all-zeros) instance is never available in the wild. This is the
> most prominent encapsulation-breaking compromise that an author makes when
> moving from B2 to B3.
>

Yeah, I'm somewhere on that end of the spectrum too, about types like
`Instant` (in fact I started calling this the 1970 problem). I only even
say the above because in such cases there *is* the fallback of gritting
teeth and getting comfortable in bucket 1. Sad, but my thought was that
three kinds of concrete classes (times three kinds of concrete classes) is
sad too.

-- 
Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at google.com


More information about the valhalla-spec-observers mailing list