Boost logo

Boost :

Subject: Re: [boost] [contract] syntax redesign
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2011-05-31 17:35:34


On Tue, May 31, 2011 at 5:21 PM, lcaminiti <lorcaminiti_at_[hidden]> wrote:
>
> If the return type is a "keyword" known a priori like void then no
> parenthesis should be needed.

Oh, so you just special-cased some keywords and the rest require
parentheses? That's good. The only criticism I have of that is that it's
inconsistent. I had some special-casing to eliminate parentheses, similar to
what you are doing, but I ultimately sided on being consistent over
everything else. That's obviously just my opinion, so I'm not saying you
should definitely change it, it's just something to consider.

Also, given your description (using IS_UNARY), it sounds as though your
current implementation cannot handle return types that have top-level
commas. For instance, you can't return a boost::array< int, 2 > directly
without using a typedef (and if that return type is dependent on the
function's template parameters then you could potentially be stuck). I
highly recommend that you use variadic macros here to directly check if it's
anything parenthesized other than empty. It looks like you're already
relying on variadic macros for your parameter lists, so you wouldn't be
introducing further compiler requirements.

> I have done some experimentation that indicates this syntax _should_ be
> possible but it's not actually implemented yet so... we'll see :)

It's definitely possible, yes.

-- 
-Matt Calabrese

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