"Andrei Alexandrescu" <seewebsiteforem...@erdani.org> wrote in message news:j5ge8v$2a0h$1...@digitalmars.com... > On 09/22/11 16:08, bearophile wrote: >> Andrei Alexandrescu: >> >>> A function literal should be comparable to another for equality. >> >> Are you willing to explain me why, and show an use case? > > An important application is optimizing for specific lambdas (e.g. > equality). For example, a substring search using equality for characters > could use bitwise comparison. > > Andrei >
I think this is better handled by a library solution - define standard templated comparators somewhere and have special support for these. There are dozens of ways to write the same comparison in D and allowing equality tests to work in some cases is likely to be as frustrating as string1 == string2 working sometimes in java.