recursive equal, and firstDifference functions

Jonathan M Davis jmdavisProg at gmx.com
Tue Mar 19 10:20:21 PDT 2013


On Tuesday, March 19, 2013 18:08:53 timotheecour wrote:
> I think none of you got the point of equalRecurse, so let me
> clarify.
> 
> equalRecurse should work on any type, not just inputRanges,

Which is fundamentally wrong. == and equal are two very different operations, 
even if their intent may be similar. And aside from ranges, unless you're 
creating your own function for checking for some other type of equality beyond 
what ==, is, or equal check for, all you'd ever use is == or is anyway. So, if 
you want to compare ranges with equal, then use equal. Otherwise use ==. 
Expecting the compiler to automagically figure out how to compare two types for 
you is just begging for trouble (especially when you add stuff like alias this 
into the mix).

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list