Boost logo

Boost :

Subject: Re: [boost] [contract] concepts: pseudo-signatures vs. usage patterns
From: Dave Abrahams (dave_at_[hidden])
Date: 2012-10-13 21:04:48


on Sat Oct 13 2012, Andrzej Krzemienski <akrzemi1-AT-gmail.com> wrote:

> I was trying to say that pseudo-signatures look like normal signatures
> and might imply that no "loose match" occurs. In contrast, usage
> patterns look like expressions, and you do expect implicit
> conversions. Although, I do not find it a major argument against
> pseudo-signatures.
>
>> Notationally speaking, I think
>> pseudo-signatures are *much* more suggestive of those semantics than are
>> valid expressions.
>
> Could you show an example where this is the case?

The example you gave illustrates it, IMO. This is obviously subjective,
but when you read the requirements as saying "this expression must be
convertible to bool" there's no obvious reason that when the expression
appears in a larger context, that conversion necessarily happens.

> I may be missing something obvious, but I would say it is the other
> way around.

All you have to do is think of the concept and its pseudo-signatures as
conceptually defining a wrapper interface over the concrete model of the
concept, through which the constrained function has all interactions
with the model, and the implicit conversions fall out as a consequence
of regular language rules. If you follow this mental model for the
concepts mechanism, many things (some outside the scope of this
discussion) fall into place logically... or at least they do for me.

-- 
Dave Abrahams
BoostPro Computing                  Software Development        Training
http://www.boostpro.com             Clang/LLVM/EDG Compilers  C++  Boost

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