Subject: Re: [boost] Boost.Algorithm design question
From: Andrew Sutton (asutton.list_at_[hidden])
Date: 2011-11-01 12:04:27
>> We attach meaning to symbols. I doubt that many people on this list
>> would read the expression "a == b" as "a and b are operated on by some
>> function with the name == that has some result".
> That really depends on the underlying types.
It should not. Equality should mean equality. I don't see why this
should be so distasteful.
> bind(&foo, _1) == 2
> as "the object which bind returns is equal to 2"; operator== on
> lambda-type objects is not an equivalence relation but instead returns
> "some result" (that happens to be a proxy for possibly evaluating an
> equivalence relation later).
I think if you read this using std::bind I think its actually
interpreted as its written: "the bound unary function is equal to 2".
Not only is that meaningless, it should be a compiler error. Refusing
to legitimize meaningless or ambiguously interpreted syntax is, I tend
to think, a good thing.
Obviously, you can hijack the syntax to change the meaning to whatever
you want, but that's not generic, and its not specific to the
algorithms being discussed. That's a specific interpretation of syntax
that you happen to be using to generate a function.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk