Boost logo

Boost :

From: Sylvain Pion (pion_at_[hidden])
Date: 2002-09-06 15:48:50


On Fri, Sep 06, 2002 at 09:22:45PM +0200, Gabriel Dos Reis wrote:
> However, the point is what makes more sense in practice *and* in the
> surrounding framework of the enclosing library (not just IA). Give it
> more thought.

Here are my thoughts :

Given the high similarity with std::complex, consistency with std::complex
is a serious option, right ?

If you want consistency with boost, boost::quaternion doesn't have any
comparison either (at first look at the doc).

> | Think at a little higher level of abstraction : think that complex could be
> | represented in polar coordinates.
>
> Yes, they could (as a Geometer I can imagine even more models). But,
> the existing practice has much more weight than sterile abstractions.

Indeed !

The lexicographic order clashes with ALL existing practice over intervals !

I don't know of any existing IA library defining the default comparison as the
lexicographic one. And they all come from slightly/completely different
sources/needs.

> | The lexicographical order on the cartesian
> | coordinates would not make any sense for a different application that your
> | mapping of points !
>
> You missed the point -- no pun intended. As I explained in another
> message, the actual implementation of the ordering was immaterial in
> the application (either in polynomial root finders or curvature line
> tracing). However, given the actual *representation*, anything other
> lexicographical would have been exercise in pure futility -- the
> observable behaviour of the program would not have been affected,
> however. Don't forget that std::complex<> does use Cartesian
> representation.

Agreed, but you may perfectly want to have a non-standard class with the same
interface _and_ associated semantic, and whose internal representation is
polar, or homogeneous. For these, the corresponding semantic of Cartesian
lexicographic order would be non-sense.

> Don't over-abstract. Or you'll get where we're with std::complex<> --
> a perfect example of standard over-abstraction.

It seems that we agree that interval and complex are really equivalent beasts
on this topic.
So all boils down to the fact that you think the standard is wrong for
complex, and you would like to push your view on boost::interval.

May I mention that I therefore have the majority of the standard commitee
on my side ? :)

More seriously, I do not know what have been the discussions of the standard
commitee (you surely know better) about this question, if there has been any.
But may I suggest that you _first_ try to get the std::complex "fixed" with
the standard working groups. And if this is accepted, come back to see if it
applies as well to interval. We will be able to add a default without
breaking backward compatibility if we don't put a default now.

Actually I do think that the natural order on the sub-domain of non-overlapping
intervals (complemented by exceptions outside this domain) is the only good
candidate for a default, but it won't work well as a blind comparator for STL
set/map.
But this one completely fits the natural usage of intervals.
Whereas I think lexicographic order is not even half a good default for
complex.

-- 
Sylvain

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk