More radical ideas about gc and reference counting

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri May 2 08:07:05 PDT 2014


On 5/2/14, 3:09 AM, "Marc Schütz" <schuetzm at gmx.net>" wrote:
> On Thursday, 1 May 2014 at 22:23:46 UTC, H. S. Teoh via Digitalmars-d
> wrote:
>> On Thu, May 01, 2014 at 03:10:04PM -0700, Walter Bright via
>> Digitalmars-d wrote:
>>> The thing is, GC is a terrible and unreliable method of managing
>>> non-memory resource lifetimes. Destructors for GC objects are not
>>> guaranteed to ever run. If you do have struct with a destructor as a
>>> field in a class, you've got, at minimum, suspicious code and a latent
>>> bug.
>>
>> Exactly!!! This is why I said we should ban the use of structs with
>> dtors as a field in a class.
>
> No, not in a class, but in any GC-managed object. It's unfortunate that
> class currently implies GC.

So now it looks like dynamic arrays also can't contain structs with 
destructors :o). -- Andrei


More information about the Digitalmars-d mailing list