RefObject and ValObject

Brian Goetz brian.goetz at oracle.com
Mon Apr 15 14:57:42 UTC 2019


> 
> Well, not quite. The choice is between treating 'new Object' specially or not. If it's not treated specially there is no new scary type. It's just that`new Object` might not have the properties one might hope for (but again, those same properties would be lost as soon as you touch the result of the expression).

OK, but let’s not lose sight of the fact that “new Object()” is not so much a language _feature_, as much as an accidental convention that people have settled on for accomplishing a very specific thing.  In a way, it’s like the so-called-but-not-really-a-feature double-brace idiom; it’s an accidental consequence of how the language works, that people have come to use because it’s convenient. 

I would much rather spend our complexity budget migrating uses of this idiom away and get a simpler type system, than the other way around.




More information about the valhalla-spec-observers mailing list