More on substitutibility and why this it is desirable...
Equality
Now we need to define equality. The terminology is messy, as so many
of the terms we might want to use (object, value, instance) already
have associations. For now, we'll describe a _substitutability_
predicate on two
- Mail original -
> De: "Brian Goetz"
> À: "Remi Forax" , "John Rose"
> Cc: "valhalla-spec-experts"
> Envoyé: Jeudi 21 Février 2019 14:37:31
> Objet: Re: acmp again !
>> Again pick your poison.
>
> The phrase "pick your poison" is misleading because it suggests all
> poisons are
You mean the double comparison use doubleToLongBits, in that case,
value record Box(double value);
new Box(0.0) == new Box(-1 * 0.0) // false
which is not better.
Rémi
- Mail original -
> De: "Brian Goetz"
> À: "Remi Forax" , "John Rose"
> Cc: "valhalla-spec-experts"
> Envoyé:
NaN is interesting because it creates another corner case where the == will be
surprising if it's implemented has a component wise comparison,
value record Box(double value);
var box = new Box(Double.NaN);
box == box // false
so both semantics are not reflective.
Go re-read
- Mail original -
> De: "John Rose"
> À: "Brian Goetz"
> Cc: "Remi Forax" , "valhalla-spec-experts"
>
> Envoyé: Jeudi 21 Février 2019 04:25:27
> Objet: Re: acmp again !
> On Feb 20, 2019, at 5:48 PM, Brian Goetz wrote:
>>
>>
>>>
>>> It doesn't match my experience, currently people
- Mail original -
> De: "Brian Goetz"
> À: "Remi Forax" , "John Rose"
> Cc: "valhalla-spec-experts"
> Envoyé: Jeudi 21 Février 2019 02:48:09
> Objet: Re: acmp again !
>>
>> It doesn't match my experience, currently people have no expectation of what
>> ==
>> means on a value type, if