|
Boost : |
Subject: Re: [boost] request for interest in a garbage collection library
From: Bastek (snibisz_at_[hidden])
Date: 2009-04-17 11:57:22
> Jumping in here, the problem is that having to mix GC code, which
> automatically releases memory in a non-deterministic way, and normal
> RAII destructor code, which releases all resources in a deterministic
> way, creates two different syntaxes in a C++ program. This would
> currently require the programmer to "know" which type of destruction
> belongs with which object.
>
> Unless the same external syntax can automatically be used on all
> objects, where the classes of those objects which need deterministic
> destruction automatically use RAII destruction whereas the classes of
> those objects which only need non-deterministic destruction use GC, I do
> not think C++ programmers will ever be enthusiastic about using a
> garbage collector. At least I know that I won't and will stick with
> shared_ptr with the occasional scoped_ptr/weak_ptr until a way to
> syntactically unite RAII and GC is accomplished.
>
> GC has successfully masked the fact, in langages/environments like
> Python, Ruby, Java, .Net, that it is a very poor system for dealing with
> any resource other than memory.
The way of releasing resources may be dependent on the type of
object.
If you use my GC (http://sourceforge.net/projects/sgcl), you can
write:
class Foo {};
class Bar : public Limited {};
gc<Foo> foo = gcnew Foo;
gc<Bar> bar = gcnew Bar;
Bar-class destructor will be called in a deterministic way.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk