On 24 September 2013 00:05, Andrei Alexandrescu < [email protected]> wrote:
> On 9/22/13 10:37 PM, Walter Bright wrote: > >> On 9/22/2013 9:19 PM, Manu wrote: >> >>> Following this train of thought, I can imagine a really nice end goal >>> would be >>> that the existing GC is effectively plugged in as a library, and >>> people can >>> easily substitute it for their own GC if they want/need to. >>> >> >> It already is, and has been from the beginning. Rainer, for example, >> uses a different GC for VisualD. >> > > Correct. > > > dmd knows naught about the GC. >> > > Well except for plugging a library call for calls to new. But that's > expected. > > (I'm already pretending delete doesn't exist :o).) delete is important if your class is being allocated by a pool or something... But you said before, people won't use 'new' if they are using an allocator. I'm really not sure that's a good idea. Most people (library authors!) don't actually care about their memory allocation, they will continue to use 'new', just because it's a keyword. It also screws with generic code; X should be allocated with 'new', but Y should be allocated with yAllocator.alloc()? What if you decide that Z, which allocates with 'new', becomes a problem and you want to switch it into a pool? You now need to track down every instance of 'new Z', and change it.
