What I was describing came from an essay by Henry Baker:

    http://home.pipeline.com/~hbaker1/ObjectIdentity.html

IIRC his argument was: identity is an abstraction violation for immutable data 
structures (you should be free to copy or share immutable data without changing 
program behavior), but identity is critical for mutable data because contents 
are ephemeral and don't completely identify the data structure.

The slow path for structural equality seems wrong for Rust to me: either it's 
an expensive footgun or we work extra hard to optimize dynamically à la:

    http://www.cs.indiana.edu/~dyb/pubs/equal-abstract.html

but either way seems wrong for a systems language.

(I have a general worry that we shouldn't get too creative with our equality 
operators, since historically they've been such a source of problems -- Common 
Lisp has too many, Scheme's is too expensive, JS's are bonkers. I'm not opposed 
to having more than one, although if any are truly polymorphic they could 
perhaps be functions instead of infix operators.)

Dave

On Aug 30, 2011, at 10:41 AM, Graydon Hoare wrote:

> On 11-08-29 12:11 PM, Patrick Walton wrote:
>> On 8/29/11 8:34 AM, Graydon Hoare wrote:
>>> (Others: feel free to chime in, we've been back-and-forth on this issue
>>> in conversation since ... years now?)
>> 
>> Dave suggested pointer equality only on mutable boxes, but deep equality
>> on immutable boxes. This might be a nice sweet spot.
> 
> Feels more POLS-violating to me than either shallow or deep+fail.
> 
> Or, um, marijn's suggestion might also be ok (if odd in a systems language), 
> about a fast path + slow path combo.
> 
> Switching by mutability feels particularly surprising.
> 
> -Graydon
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to