Re: opEquals default behaviour - poorly documented or am I missing something?

2015-11-19 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, November 17, 2015 20:25:30 user123ABCabc via Digitalmars-d-learn wrote: > On Tuesday, 17 November 2015 at 19:44:36 UTC, Ali Çehreli wrote: > > if (typeid(a) == typeid(b)) return a.opEquals(b); > > Wow this is terrible to compare two objects in D. The line I > quoted means that two

Re: opEquals default behaviour - poorly documented or am I missing something?

2015-11-18 Thread MichaelZ via Digitalmars-d-learn
On Tuesday, 17 November 2015 at 19:44:36 UTC, Ali Çehreli wrote: On 11/17/2015 12:40 AM, MichaelZ wrote: > In http://dlang.org/operatoroverloading.html#eqcmp it is stated that > > "If opEquals is not specified, the compiler provides a default version > that does member-wise comparison." > >

Re: opEquals default behaviour - poorly documented or am I missing something?

2015-11-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/17/15 3:25 PM, user123ABCabc wrote: On Tuesday, 17 November 2015 at 19:44:36 UTC, Ali Çehreli wrote: if (typeid(a) == typeid(b)) return a.opEquals(b); Wow this is terrible to compare two objects in D. The line I quoted means that two TypeInfoClass are likely to be allocated, right ?

Re: opEquals default behaviour - poorly documented or am I missing something?

2015-11-17 Thread Ali Çehreli via Digitalmars-d-learn
On 11/17/2015 12:40 AM, MichaelZ wrote: > In http://dlang.org/operatoroverloading.html#eqcmp it is stated that > > "If opEquals is not specified, the compiler provides a default version > that does member-wise comparison." > > However, doesn't this only apply to structs, and not objects?

Re: opEquals default behaviour - poorly documented or am I missing something?

2015-11-17 Thread user123ABCabc via Digitalmars-d-learn
On Tuesday, 17 November 2015 at 19:44:36 UTC, Ali Çehreli wrote: if (typeid(a) == typeid(b)) return a.opEquals(b); Wow this is terrible to compare two objects in D. The line I quoted means that two TypeInfoClass are likely to be allocated, right ? But usually when comparing objects one

opEquals default behaviour - poorly documented or am I missing something?

2015-11-17 Thread MichaelZ via Digitalmars-d-learn
In http://dlang.org/operatoroverloading.html#eqcmp it is stated that "If opEquals is not specified, the compiler provides a default version that does member-wise comparison." However, doesn't this only apply to structs, and not objects? The default behaviour of opEquals for objects seems