Reference-default style

John Rose john.r.rose at oracle.com
Fri Feb 7 23:43:57 UTC 2020


On Feb 7, 2020, at 3:39 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> 
> 
>> (To remind everyone:  We are using two half-buckets rather than one bucket
>> mainly so that Optional can be migrated.  If it were just supporting V? then
>> we’d use an empty marker type, I think, probably just an interface.)
> 
> The two half buckets also exist because it is how we get primitives and inlines to be the same thing, and not end up with THREE kinds of types.

Good point; thanks.  In the case of primitives, it might turn out to be
more than two half-buckets, depending on if and how we choose to
support identity-bearing primitive wrappers (today’s new Integer(42)).

Towards the baroque end of things, I can imagine a three-bucket solution:

nest {
abstract class Integer permits intThePrimitive, intTheBox {
   …migration support here…
}
inline class intThePrimitive extends Integer {
   …
}
final class intTheBox extends Integer {
  private final intThePrimitive value;
  ...
}
}



More information about the valhalla-spec-observers mailing list