On Monday, 1 May 2017 at 04:54:28 UTC, Andrei Alexandrescu wrote:
On 4/30/17 8:43 PM, Stanislav Blinov wrote:
On Sunday, 30 April 2017 at 21:43:26 UTC, Andrei Alexandrescu wrote:
On 04/27/2017 07:35 PM, Stanislav Blinov wrote:
IAllocator is too high level an interface, it doesn't carry any information as to what type of memory it can allocate (so we can only assume unshared), and does or does it not use GC (so we can only assume
GC).

Initially all fresh memory is unshared. Whether or not the user subsequently shares it is of no consequence to the allocator.

Why would we need any ISharedAllocator then?

The allocator itself may be shared across threads...

But it is no different in case of memory. Allocator that allocates shared memory should either return shared(void)[] or have an explicit interface (allocateShared et al.), not just have the "you may cast result of allocate() to shared" somewhere in the docs. We should let the language do the work it can, not send us to RTFM. Hence my earlier statement that more interfaces are needed, as one possible (albeit not pretty) solution.

Reply via email to