
Andrew Sutton wrote:
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++.
I think there are probably too many places where a compiler can fail. Try to find all of the broken language aspects in Boost.Config, and then generalize this solution to all of those. You'd end up having this construct around, well, most of your program. The only viable solution to this is the preprocessor - it's ugly, but it's been effective for 30 years, and I don't see it going away any time soon :)
Preprocessor doesn't always save you. I had couple of times when I needed to detect availability of a non-member type or function - mostly, for portability reasons. This is where scary things like above or __if_exists/__if_not_exists MSVC extension may come handy. I wonder if concepts are able to do that.