New candidate JEP: 401: Primitive Objects (Preview)

Stephen Colebourne scolebourne at joda.org
Sat Mar 20 08:40:00 UTC 2021


On Sat, 20 Mar 2021 at 02:02, Brian Goetz <brian.goetz at oracle.com> wrote:
> > When reading the proposal I see that in the feature we will get code like:
> >
> > Optional.val<User> findUser(...)
>
> This is not what we anticipate.  I would expect that for migrated types,
> public interfaces would continue to use Optional (alias for
> Optional.ref); we'd mostly only see Optional.val inside of private
> implementation, where things actually hit the heap.

Why do you anticipate that?

The messaging I see is:
  Optional = old, slow, memory-hop
  Optional.val = new, fast, flattened
and as such, I would naturally use Optional.val in the API methods.

Stephen



More information about the valhalla-dev mailing list