Thread overview
IAllocator
Jan 04, 2016
Rikki Cattermole
January 03, 2016
https://issues.dlang.org/show_bug.cgi?id=15509 is up. Any takers? -- Andrei
January 04, 2016
On 04/01/16 11:44 AM, Andrei Alexandrescu wrote:
> https://issues.dlang.org/show_bug.cgi?id=15509 is up. Any takers? -- Andrei

Now I'm worried, this will break a lot of my code.
I'm just not convinced that RefCounted is the correct tool for this job.

It changes the allocator type. IAllocator is an interface for a reason.
It allows swapping things out without worrying about implementation and using templates.

If you go this route, I want a SwappableAllocator implementation like SwappableImage[0] is.

[0] https://github.com/rikkimax/alphaPhobos/blob/master/source/std/experimental/graphic/image/interfaces.d#L205
January 04, 2016
On 01/03/2016 11:50 PM, Rikki Cattermole wrote:
> On 04/01/16 11:44 AM, Andrei Alexandrescu wrote:
>> https://issues.dlang.org/show_bug.cgi?id=15509 is up. Any takers? --
>> Andrei
>
> Now I'm worried, this will break a lot of my code.

May break if you use the IAllocator type explicitly a lot; you need to change that name.

> I'm just not convinced that RefCounted is the correct tool for this job.

It may not because it gives access to the underlying interface, which I'd rather keep encapsulated. I think a hand-defined proxy struct around the IAllocator type is the ticket.

> It changes the allocator type. IAllocator is an interface for a reason.
> It allows swapping things out without worrying about implementation and
> using templates.

That won't go away. I guess I need to write the code to fully explain what's needed.


Andrei