While we were discussing lambda syntax..

spir denis.spir at gmail.com
Sat Jan 1 06:52:36 PST 2011


On Sat, 1 Jan 2011 09:56:25 +0100
Philippe Sigaud <philippe.sigaud at gmail.com> wrote:

> As I said in the docs, I got stuck at comparison operators. a <  b is
> automatically transformed by the compiler into a.opCmp(b) < 0.
> a.opCmp(b) becomes another lambda and the '< 0' part triggers another
> expansion, ad infinitum...

Is this a good design choice? I mean opCmp looks like a good idea (wrapping all comparisons in a single one instead of having to implement all separatedly), but is it really one? It currently annoys me for a custom sort where what I need is just less-than. opEquals is already apart: I would vote +++ for opLessThan. Then, a programmer can get rid of opCmp alltogether (I don't mean it should be deprecated, may have uses).

Denis
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d mailing list