more band aid coming - Object methods on 'any' tvars
Brian Goetz
brian.goetz at oracle.com
Fri Jan 16 16:59:06 UTC 2015
If you mean "null" as the existing syntax... that would be semantically
confusing. It would creates the idea in the user's head that null and 0
are the same thing. Then they'll expect "x == null" to mean "x == 0"
for ints. They'll expect to be able to assign null directly to an int,
and have it coerced to zero. And now it's not just syntax, its
conceptual, and they have to build a new concept of null. Overloading
this syntax essentially pushes us into a different mental model, and
hence a different feature. We definitely DO NOT want to just say "null
for int means 0".
So while this sounds like a syntax issue, it's not really.
On 1/16/2015 11:54 AM, Simon Ochsenreither wrote:
>> I've just pushed a compiler/specializer patch that adds support for
>> T.default.
>
> I really don't want to start a syntax discussion, but what's the reason
> to introduce a special syntax where existing syntax would have been
> sufficient?
>
More information about the valhalla-dev
mailing list