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?

I don't know whether it's a good idea all-in-all, but assuming the arguments can be used as compile-time I can already see a big use case: killing autodecoding without breaking code. Something like:

auto front(C, bool disableDecoding = __NODECODE__)(inout C[] string)
{   static if (disableDecoding) {...}
    else {...}
}

Reply via email to