|
Boost : |
Subject: Re: [boost] [contract] syntax redesign
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2011-06-01 11:00:49
On Wed, Jun 1, 2011 at 10:01 AM, lcaminiti <lorcaminiti_at_[hidden]> wrote:
>
> Questions:
> 1) How bad is this? I am afraid that giving up this kind of automatic type
> deduction makes generic programming less convenient... am I right? ( I'm
> not
> a generic programmer ;) )
>
Yes, it just makes things less convenient and that's pretty much all. It's
really not that bad since it's not an incredibly common case. Just make the
macro remove the parentheses when variadic macros are present.
> 2) Does anyone know of a better way to handle commas within macro parameter
> types but without using variadics?
>
The function parameter trick is pretty much the best (only?) way to handle
that kind of problem, at least that I'm aware of, since there's not really
anything you can do entirely during preprocessing without variadic macros.
Anyway, many or most compilers support them now (they've been standard C for
over a decade now) and, as I'm sure you know, variadic macros are in the
C++0x FDIS, so they will be standard in C++ very soon.
If I could recommend one thing, focus primarily on variadic macros and treat
the non-variadic case as a workaround, if you maintain such support at all.
Don't go overboard trying to account for users who don't have access to
compilers that can deal with variadic macros unless someone is explicitly
requesting support. The number of such users likely isn't very high at all
and it will only be getting smaller. Working with variadics simplifies
things greatly both for users and for yourself as an implementor.
Anyway, good luck. Your interface looks awesome.
-- -Matt Calabrese
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk