> On Mar 31, 2021, at 3:27 PM, Maurizio Cimadamore 
> <maurizio.cimadam...@oracle.com> wrote:
> 
> What I'd be curious though, is if the @ValueBased annotation could be 
> enhanced to say _which_ primitive class default you want (and then javac 
> could enforce extra checks if you pick the "val" default). If something like 
> this was feasible (cc'ing Dan), maybe some of the friction here could be 
> removed?

You mean annotate a class with "pretend this class's name represents a value 
type" and then implement the associated null checks in javac, even though we 
don't actually have value types yet?

I'd expect that to run into a number of problems related to the fact that the 
language model hasn't actually been updated to include primitive classes or 
value types yet. Plus the lack of features like reference types (Foo.ref) would 
be limiting for programmers who need them. Plus binary incompatibility—value 
types need special encoding in class files, and those class files aren't legal 
yet; when they are, you risk mismatches.

In this case I think the straightforward approach of just completing and 
delivering the Valhalla features is better than trying to spin off a small 
taste of them early.

Reply via email to