Value types and nulls
brian.goetz at oracle.com
Mon May 21 20:27:21 UTC 2018
> Going out on a limb here, I'd like to say that nulls are useful, and
> value types need to have a similar concept.
While I think “need” might be a tad extreme, yes, we get it. Nulls are part of the programming model, and that not having any way to engage null (especially for migrated classes, but also in other situations, such as analogues with the primitive boxes, which are important to the “acts like an int” story) is going to be limiting. There are, as you suggest, many degrees of freedom here, with pros and cons.
For the first iterations of the prototypes, though, we’re going to aggressively push back on nulls (and on other things too). This is not because we don’t recognize that it is important, its because we need to prune the complexity space in both the implementation and the programming model so we can get actionable feedback on the more central aspects of the design first. So, I’ll just ask that you hold off on reminding us how important null is for a while; we’re going to be focused on more fundamental questions for a bit. Rest assured we have already fully internalized everything you’ve said here.
Use-site nullity indications for values also raise the possibility for convergence in the long term with another long-requested feature — non-nullable reference types, sometimes written `String!`. We’re keeping our eyes on possibilities here too. (But, please, we’re surely not ready to talk about this yet.)
More information about the valhalla-dev