DIP 1020--Named Parameters--Community Review Round 2

jmh530 john.michael.hall at gmail.com
Tue Sep 17 13:52:01 UTC 2019


On Tuesday, 17 September 2019 at 13:36:59 UTC, rikki cattermole 
wrote:
> [snip]
>
> So with signatures you essentially need a separate parameter 
> type which says: will probably be inferred from something but 
> can be set by the user if they really need to.
>
> In your above example, I suspect it will have name collisions 
> as-is.
>
> [snip]

Would it help to use opDispatch? Maybe something like below 
(assuming types are first class objects):

struct Foo(T) {
     type opDispatch(string U)()
         if (is(T == mixin(U))
     {
         return mixin(U);
     }
}


More information about the Digitalmars-d mailing list