Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2007-10-18 10:51:34


on Wed Oct 17 2007, Rene Rivera <grafikrobot-AT-gmail.com> wrote:

> David Abrahams wrote:
>> on Tue Oct 16 2007, "Marco Costalba" <mcostalba-AT-gmail.com> 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++.
>
>> 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.
>
> OK, that has got to be one of the lamest excuses I've heard from
> compiler vendors so far. All the compilers I've written have had some
> form of stacked symbol tables for the sole point of implementing scopes.
> And this is just another scope use case.

No, it's not. You have to be able to undo template instantiations and
other permanent state changes that can't be stacked.

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

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