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

Brian Goetz brian.goetz at oracle.com
Mon Apr 25 19:54:26 UTC 2022


This seems very specific to Optional, for Optional storing null is always a mistake, but that's not true for other VBC, by example a deadline can be typed as an Instant with null meaning no deadline.

No, it is not specific to Optional at all.  Many domains exclude null on an ad-hoc basis.

It is about giving the user the choice to reserve space in the heap for the null or not.  If other logic has already excluded null (which is common), they can use an Instant.val and get better footprint.  If they like the semantics of having null, they can use Instant.




More information about the valhalla-spec-observers mailing list