Extend the call site default argument expansion mechanism?

jmh530 john.michael.hall at gmail.com
Fri May 11 22:06:57 UTC 2018


On Friday, 11 May 2018 at 11:42:07 UTC, Dukc wrote:
> [snip]
>
> 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 {...}
> }

I'm not sure this makes sense or not...but what about instead of 
implicits, you allow a template to have type erased parameters, 
basically to optionally mimic the behavior of Java's generics. 
That way the allocator could be included in the type and checked 
at compile-time, but it wouldn't be known at run-time (not sure 
that's a positive or not).


More information about the Digitalmars-d mailing list