DIP 1023--Resolution of Template Alias Formal Parameters in Template Functions--Community Review Round 1

Stefanos Baziotis sdi1600105 at di.uoa.gr
Fri Sep 6 12:27:50 UTC 2019


On Friday, 6 September 2019 at 12:17:11 UTC, rikki cattermole 
wrote:
> The D code blocks should have the language set to D (```d ... 
> ```) for easier reading.
>

Thanks, I didn't know about that.

>
>
> Your examples in abstract didn't look right.
> I ran the second to confirm my suspicion:
>
> onlineapp.d(9): Error: undefined identifier T
>
>

Could you paste the example that gave you this error?
Btw, not all examples are compilable.

>
> Here is the test case in your implementation linked that made 
> me understand your intention for the DIP:
>
> ```
> void main() {
>     TestAlias!(int, float) testObj;
>     testFunction(testObj);
> }
>
> struct TestType(T, Q) { }
> alias TestAlias(T, Q) = TestType!(T, Q);
> static void testFunction(T, Q)(TestAlias!(T, Q) arg) { }
> ```
>
> Current error:
>
> onlineapp.d(5): Error: template onlineapp.testFunction cannot 
> deduce function from argument types !()(TestType!(int, float)), 
> candidates are:
> onlineapp.d(10):        onlineapp.testFunction(T, 
> Q)(TestAlias!(T, Q) arg)

Yes, this example shows exactly the intention. Among other 
things, the DIP
proposes that we should not have an error here.


More information about the Digitalmars-d mailing list