I have made a discovery

weaselcat via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 18 22:46:28 PDT 2015


On Sunday, 19 April 2015 at 02:42:28 UTC, ketmar wrote:
> On Sun, 19 Apr 2015 00:50:23 +0000, weaselcat wrote:
>
>> maybe I'm dumb in asking this, but if there was already an API 
>> for
>> allocators in D... why is a std.allocator not being written 
>> ontop of it?
>> it seems much more elegant to begin with.
>
> ability to override `new` and `delete` is a big can of worms. 
> c++ got
> into that, and now it's not recommended to touch that operators.
>
> in a short: it's inflexible (you can't use two different `new` 
> with one
> class, for example -- if not count the weirdo `new(5) A()` and 
> such), you
> can't predict how your class will be allocated (yea, you didn't 
> define
> `new` for your class... but one of it's parents did and... 
> bam!) and so
> on.
>
> so i fully understand why it's silently deprecated. yet i still 
> don't
> want it to go. ;-)

I was unaware of how the override new worked, after reading the 
thread again it makes more sense why it's not used now.
Thanks.


More information about the Digitalmars-d mailing list