More radical ideas about gc and reference counting

Benjamin Thaut via Digitalmars-d digitalmars-d at puremagic.com
Sat May 3 02:45:42 PDT 2014


Am 01.05.2014 19:35, schrieb "Marc Schütz" <schuetzm at gmx.net>":
>
> But conceptually, this is _not_ the same as classes! As others have
> mentioned, it's possible to created structs with `new`, or have them in
> dynamic arrays, as well as managing class objects manually.
>
> Maybe the language should have some way to distinguish between
> GC-managed and manually-managed objects, preferably in the type system.
> Then it could be statically checked whether an object is supposed to be
> GC-managed, and consequentially shouldn't have a destructor.
>
> The difference between classes and structs should then be reference vs.
> value semantics, and polymorphic vs static (which correlate nicely). It
> should, however, not imply whether the object is managed by the GC or
> not. Some kind of ownership mechanism would be more suited for that.

+1


More information about the Digitalmars-d mailing list