Question on layer/peeling

Michael Barker mikeb01 at gmail.com
Tue Jan 6 20:38:52 UTC 2015


>
> The trick can also be coaxed to give semi-plausible semantics to seemingly
> bogus expressions like "x == null" or "x == (Object)y" (for any x).  If "x"
> is a primitive, since autobox conversions never produce "null", then "x ==
> null" and "x == (Object)y" are complicated ways of saying "false".  But
> this doesn't help with nulling assignments like "a[i] = null"; there you
> need "T.null" (my bikeshed preference to "default(T)").
>

I think allowing x == null (always false) and a[i] = T.null for value types
would certainly make the coding simpler as it would avoid layering for a
number of very common cases.  In the null comparison case I would assume
that Hotspot could easily throw away the condition altogether in the
specialised class.


More information about the valhalla-dev mailing list