On Wednesday, March 20, 2013 03:48:38 Dan wrote: > On Wednesday, 20 March 2013 at 02:03:31 UTC, Jonathan M Davis > > wrote: > > We already get this. That's what == does by default. It's just > > that it uses == > > on each member, so if == doesn't work for a particular member > > variable and the > > semantics you want for == on the type it's in, you need to > > override opEquals. > > Really? > > string is one most people would like == to just work for. This > writes true then false. This certainly takes getting used to. It > alone is a good reason for the mixins and potentially a > non-member instancesDeepEqual. > > import std.stdio; > struct S { > string s; > } > void main() { > writeln("foo" == "foo".idup); > writeln(S("foo") == S("foo".idup)); > }
That's a bug: http://d.puremagic.com/issues/show_bug.cgi?id=3789 - Jonathan M Davis