RAII is misleading
duff via Digitalmars-d
digitalmars-d at puremagic.com
Tue Nov 24 08:12:21 PST 2015
On Tuesday, 24 November 2015 at 15:14:16 UTC, duff wrote:
> I've discovered this when working on a kind of "fat pointer"
> system.
>
> The "RAII" term is misleading, it tends to let people think
> that the one who initializes a resource is its owner.
>
> The reality is different. The real owner of a resource is the
> one who see it "as valid" for the first time.
You would like to serialize a tree of object ?
Using ReferenceCounting: which one has to write the properties of
an object that's only a reference ?
Using ReferenceCounting: let's say that the last object who has a
referenced object serialiazes it, there's no guarantee that when
the soft run again his reference is already set...
The only way to do this correctly is to use system of ownership
rather than RC system.
More information about the Digitalmars-d
mailing list