Re: Future of C++
on Wed Aug 20 2008, gpderetta <gpderetta-AT-gmail.com> wrote:
On Aug 19, 11:44 am, David Abrahams <d...@boostpro.com> wrote:
on Mon Aug 18 2008, gpderetta <gpderetta-AT-gmail.com> wrote:
On Aug 17, 5:28 pm, David Abrahams <d...@boostpro.com> wrote:
What we need, as I've said, is a programming model that allows us to
safely and effectively combine GC'd C++ that doesn't call destructors
with existing code using dtors to manage non-memory resources.
So you think we need more than better documentation?
Well, programming models typically do not show up in documentation, but
in books, articles, and technical papers. I'm talking about a framework
of understanding that allows us to reliably write and reason about
nontrivial C++ systems in the presence of GC.
Do you think this is necessary *before* getting GC in the standard?
Absolutely.
Or will it come with time after that?
If we standardize first, it may or may not come with time. See
exception-specifications.
A requirement for the implementation to support optional garbage
collection.
I can't think of any normative standard language that would express such
a requirement. AFAIK the only observable effect is that the program can
get away with leaking more memory when GC is on.
I think that as long as conservative collectors are allowed, you are
right that no formal requirement can be given.
And documenting whether standard containers (and other
standard objects) are allowed to hold non memory resources.
That wouldn't be much to document, because they can today, and we're not
going to break the old code.
Just to be clear: I would like the standard to say that, as long as
the contained objects (under the control of the user) do not own any
non memory resources (i.e. their constructors need not to be called),
standard containers need not to be explicitly destroyed when GC is on.
So, you would outlaw implementations with threadsafe containers (they'd
need an associated mutex)? Even though I think that is usually a design
mistake, I'm not sure I'd be willing to constrain implementations in
that way.
Is there any standard library implementation that has containers that
hold non memory resources?
I don't know.
--
Dave Abrahams
BoostPro Computing
http://www.boostpro.com
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]