[std-interval] Comparisons

Sylvain Pion Sylvain.Pion at sophia.inria.fr
Sat Aug 12 19:25:02 PDT 2006


George Corliss wrote:
> As this groups does not yet appear to have reached a consensus on comparison
> operators, there are some additional thoughts.

As far as I'm concerned, I understand that several different semantics
are desired.  I am unsure about the best way to provide these in C++,
but so far the proposal puts them in separate namespaces, so at least
they are easily available.  I am keeping an eye on the evolution of the
language, most importantly the concepts, if we can find better ways to
provide the various semantics.

> I've been asked to teach a database class for the first time in my career,
> so I am reading about SQL (Structured Query Language).  Interestingly, SQL
> uses a three-valued logic with values TRUE, FALSE, and UNKNOWN.
> 
> The rationale seems to be
>    1. Fields in a database often have values NULL
>    2. Comparisons with NULL yield UNKNOWN
>    3. Need "Boolean" operators on results of comparisons
> 
> The analogy with intervals is not perfect, but it is informative.  Since
> databases are more widely used than intervals, their standards have endured
> severe scrutiny and extensive practical applications.  We may have something
> to learn.

Thanks for the information, George.  It's good to see that
the SQL semantic is covered by our bool_set proposal.  It
makes one more motivation to standardize something like this.

I would be curious about the details, though.  What happens
if you do "if(UNKNOWN)" (or the equivalent in SQL, if there
is an equivalent) ?

-- 
Sylvain


More information about the Std-interval mailing list