Questions on default values

John Rose john.r.rose at oracle.com
Fri Mar 19 18:57:46 UTC 2021


On Mar 19, 2021, at 7:43 AM, Brian Goetz <brian.goetz at oracle.com<mailto:brian.goetz at oracle.com>> wrote:


Is this analysis correct?
(If so, then I'm pleased. I wrote some "requirements" in July 2020
exactly along these lines but never sent them to the list)

The fact that you're pleased is not necessarily encouraging, sad to say; it's evidence for our biggest concern about this approach, which is that it will be an attractive nuisance ("Finally, my nullable value types"), developers will be unaware of the performance tradeoffs they are making, and then conclude "value types suck."

The feature here is *not* "nullable value types", as much as some would like that to be the feature!  The feature here is "detection of uninitialized primitives."  It is convenient that the latter travels through null, but null is a means to the end, not the end.

Piling on:  The idea of vull/null transcoding is about two years old,
and has been discussed at length in Valhalla design meetings,
with non-Oracle people present, though (sadly) not minuted
externally.  I find it a most charming idea.

The reason it has not seen more wide distribution is that it has
hard-to-control performance implications, as Brian points out.
That is true even if you allow a “pivot field” to improve vull
detection.  (Both “vull” and “pivot field” are terms from the
old discussions.)  BTW, the problem of inferring pivot fields is
all by itself an absorbing one.  It requires an analysis akin
to safe publication analyses for references.

Our plate is very very full just doing the basic features that
Valhalla requires to survive at all.  Like Stephen, I personally
would hope to see the vull/null transcoding idea get some
more oxygen in several years, when the basic Valhalla
infrastructure is well understood and running nicely.

It could very well fail even then as a general purpose
feature, due to the overheads Brian mentions, but
maybe it will have some viability due to as-yet
engineered optimizations.  It is *not* a requirement
for Valhalla’s viability in the same way that
generic support is, and generics surely pose a much
more compelling demand for our time and effort.

— John



More information about the valhalla-dev mailing list