Disadvantages of ARC
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Thu Feb 6 09:54:38 PST 2014
On 2/6/14, 9:18 AM, Adam D. Ruppe wrote:
> Something that mallocs should return Malloced!T which calls the
> appropriate free (specified by the allocator) in the destructor. GC
> should return GC!T. Refconted should return RefCounted!T, and so on.
That ain't going to work.
Malloced!T and GC!T suggests parameterization by the type of the
allocator. So there would need to be a type per allocator, which is a
losing proposition from std.allocator's viewpoint, since there can be so
many of them via template combinatorics.
RefCounted!T is a whole different thing, because it doesn't encode
allocation strategy but instead memory reclamation tactics. There's no
"and so on" and RefCounted!T cannot occur in an enumeration that
includes Malloced!T and GC!T.
Andrei
More information about the Digitalmars-d
mailing list