Value equality (was: Value types questions and comments)
Remi Forax
forax at univ-mlv.fr
Mon May 16 18:56:12 UTC 2016
----- Mail original -----
> De: "Brian Goetz" <brian.goetz at oracle.com>
> À: "Kevin Bourrillion" <kevinb at google.com>
> Cc: valhalla-spec-experts at openjdk.java.net
> Envoyé: Lundi 16 Mai 2016 20:20:38
> Objet: Value equality (was: Value types questions and comments)
>
> Kevin say:
>
> > However, it would be very sad if it does not solve a second problem at
> > the same time, because it can. Even Java developers who are content
> > with the performance foibles of their existing "value-based classes"
> > are constantly irritated by the burden and bug-prone nature of
> > writing/maintaining such classes.
> >
>
> We have two choices in front of us regarding equality on value types:
>
> 1. What does `==` on values do? Choices include a bitwise comparison,
> a componentwise comparision (identical to bitwise unless there are float
> members), or invoking the `equals()` method.
another possible choice is to not allow == on value type (and on a T bound by any),
it makes the semantics far easier to understand, you can only use == on something which fit into a 32/64 bits,
in that case primitive types need to have an equals.
Rémi
More information about the valhalla-spec-observers
mailing list