On Friday, 11 May 2018 at 13:22:12 UTC, Meta wrote:
On Friday, 11 May 2018 at 11:42:07 UTC, Dukc wrote:
On Thursday, 10 May 2018 at 14:15:18 UTC, Yuxuan Shui wrote:
...
// constructor of DataStructure
this(Allocator alloc=__ALLOC__) {...}
...
auto alloc = new SomeAllocator();
define __ALLOC__ = alloc;
// And we don't need to pass alloc everytime
...
Is this a good idea?
Doesn't this basically mean including the implicits Martin
Odersky talked about at Dconf in D?
Yes it does. I was thinking the exact same thing while watching
his talk; implicits would be perfect for allocators.
D doesn't have Scala's implicits though. However, one can write
up a reader monad in the D we have right now.
Atila