std.allocator needs your help

Nick Sabalausky SeeWebsiteToContactMe at semitwist.com
Mon Sep 23 16:29:39 PDT 2013


On Mon, 23 Sep 2013 17:02:09 +0200
"Adam D. Ruppe" <destructionator at gmail.com> wrote:

> We should really deprecate the new keyword. It'd break like all 
> code ever, but with D's templates, there's no need for it, and 
> when it is there, it is going to spark problems about replacing 
> global allocators or the library allocators being second class 
> citizens.
> 

I think that's addressing the wrong problem, it wouldn't solve much,
if anything. We'd just end up with a lot of lib writers (and others)
hardcoding in usage of the default allocator. So it'd be exactly the
same as now, just with uglier syntax and a ton of breakage.

What's ultimately needed is a way to change the default allocator for
not only "new" but also array concatenation, closures, and any other
part of the language that might allocate. That way, we actually *do* get
the benefits we're looking for, plus we keep the nicer current syntax
and no breakage.

tl;dr: "new" is a red herring. The real issue is being able to easily
replace the default allocator.



More information about the Digitalmars-d mailing list