Subject: Re: [boost] [contract] syntax redesign
From: lcaminiti (lorcaminiti_at_[hidden])
Date: 2012-01-13 14:13:04
Dave Abrahams wrote
> on Sun Dec 11 2011, Lorenzo Caminiti <lorcaminiti-AT-gmail.com> wrote:
>> On Wed, Nov 9, 2011 at 6:16 AM, Lorenzo Caminiti <lorcaminiti@>
>>>>> The goal here is to use Boost.Contract to /completely/ specify the
>>>>> interface for the positive abstract data type.
>> For whomever is curious, the Boost.Contract named and deduced
>> parameter examples now compile:
>> Here's an example that uses a bit of everything: Contracts, concepts,
>> named/deduced function and template parameters:
> (gulp) wow! That's _very_ impressive.
> It's just too bad the syntax is so intrusive on that of C++; it's like a
> whole new language to learn, debug, etc. There are a few contract
I wanted to see if and how Contract Programming could be implemented within
C++. That came to the (big) cost of:
1) The macro syntax (plus the cryptic pp/compiler errors it generates if you
miss something, these errors could be improved a bit but the issue is
systematic- the pp is just not capable of detecting syntax errors...).
2) Increased compilation time (x 30 !!!) (but if you disable contract
compilation you get ~ x 5 plus it /might/ be possible to improve the
implementation to reduce compilation time...).
Anyway, now we know just how much C++ macros can be abused ;)
> programming frameworks out there that are much less capable but at the
> same time don't intrude so much
> (e.g. http://www.codeproject.com/KB/cpp/DesignByContract.aspx which
> probably only builds on MSVC).
I looked at that before (in fact, I think I studied /all/ Contract
Programming work for C++ that was ever done, including A++!!). As far I
remember, that approach has a few major issues: No subcontracting and the
contracts are in the definitions (instead of declarations).
> I wonder if it's possible to make parts of this framework usable in the
> same way, so that people can approach it more gradually.
If anything, it'd be nice to have a front-end (external to C++) that
translates a syntax like the one of N1962 into my library macros. My library
syntax follows closely the one of N1962 (pp a part) so this shouldn't be too
bad to implement...
-- View this message in context: http://boost.2283326.n4.nabble.com/contract-syntax-redesign-tp3563993p4293105.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk