Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2007-10-17 15:14:17

on Tue Oct 16 2007, "Marco Costalba" <> wrote:

> Starting to hack with boost libraries I found myself more and more
> stumbling across a big brick of C++ language, i.e. SFINAE works on
> types only, not on expressions.
> If an expression is ill formed there's no SFINAE around that will
> avoid you a barfing compiler.
> Looking at C++0x I failed to see a future improvement in that
> direction, also 'concepts' that will be quite new, apart from helping
> in decoding error messages (and this is a BIG help I would add), does
> not immediately seem to extend the language in that direction.
> For what I have understood 'refinements' are more or less similar to
> tag dispatching so does not seem to open completely new gates (of
> course this is just a first look opinion, it means that is not
> immediately visible to me how to use concepts to add to what you
> already can do using a more verbose approach, not that for sure it
> does not exist a way).
> I would like to ask you if someone has never dreamed of something like
> try well_formed
> {
> .... your code here...
> } catch {
> .... fall back code in case former is not compilable...
> };
> I would think this would be an extension that greatly will open new
> gates to C++.
> Just to be clear, I'm not advocating to introduce something like the
> above, just to ask if a discussion around the above lines have never
> occurred in the C++ community.

Yes, the compiler vendors have a really hard time seeing how such a
feature could be implemented. The problem is that they have data
structures such as symbol tables that are updated as code is parsed,
and there's no way to roll them back to the state they were in before
the try block if the code turns out to be ill-formed.

Dave Abrahams
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at