Thread overview | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 06, 2019 DIP 1023--Resolution of Template Alias Formal Parameters in Template Functions--Community Review Round 1 | ||||
---|---|---|---|---|
| ||||
This is the feedback thread for the first round of Community Review for DIP 1023, "Resolution of Template Alias Formal Parameters in Template Functions": https://github.com/dlang/DIPs/blob/bf5157d3dc29a591826e22d188448fbc04ca81b2/DIPs/DIP1023.md All review-related feedback on and discussion of the DIP should occur in this thread. The review period will end at 11:59 PM ET on September 20, or when I make a post declaring it complete. At the end of Round 1, if further review is deemed necessary, the DIP will be scheduled for another round of Community Review. Otherwise, it will be queued for the Final Review and Formal Assessment. Anyone intending to post feedback in this thread is expected to be familiar with the reviewer guidelines: https://github.com/dlang/DIPs/blob/master/docs/guidelines-reviewers.md Thanks in advance for keeping all discussion on topic. |
September 07, 2019 Re: DIP 1023--Resolution of Template Alias Formal Parameters in Template Functions--Community Review Round 1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | The D code blocks should have the language set to D (```d ... ```) for easier reading. Your examples in abstract didn't look right. I ran the second to confirm my suspicion: onlineapp.d(9): Error: undefined identifier T 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) |
September 06, 2019 Re: DIP 1023--Resolution of Template Alias Formal Parameters in Template Functions--Community Review Round 1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to rikki cattermole | 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. |
September 06, 2019 Re: DIP 1023--Resolution of Template Alias Formal Parameters in Template Functions--Community Review Round 1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | On Friday, 6 September 2019 at 11:45:48 UTC, Mike Parker wrote:
> [snip]
Very happy to see this.
|
September 06, 2019 Re: DIP 1023--Resolution of Template Alias Formal Parameters in Template Functions--Community Review Round 1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefanos Baziotis | On Friday, 6 September 2019 at 12:27:50 UTC, Stefanos Baziotis wrote: >> > > Thanks, I didn't know about that. > My bad. I should have caught that when I was revising. I don't normally like to push changes to a DIP under review, but anyone who would prefer to see the DIP with proper highlights is located here: https://github.com/dlang/DIPs/blob/840083a91f4c110832c1d0b61008935b277e32db/DIPs/DIP1023.md |
September 07, 2019 Re: DIP 1023--Resolution of Template Alias Formal Parameters in Template Functions--Community Review Round 1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefanos Baziotis | On 07/09/2019 12:27 AM, Stefanos Baziotis wrote: > 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. This one should be since it is stating current behavior. Looks like I got it wrong, its third not second: ``` struct TemplateType(T) { } alias TemplateAlias(T) = TemplateType!T void templateFunction(TemplateAlias!T arg) { } ``` Two errors (missed the first, semicolon missing). So: ``` struct TemplateType(T) { } alias TemplateAlias(T) = TemplateType!T; void templateFunction(T)(TemplateAlias!T arg) { } ``` >> >> 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. I replied with this so that you had feedback for improving the DIP if other people find it hard to understand. |
September 06, 2019 Re: DIP 1023--Resolution of Template Alias Formal Parameters in Template Functions--Community Review Round 1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to rikki cattermole | Thanks Mike and jmh530. On Friday, 6 September 2019 at 12:48:34 UTC, rikki cattermole wrote: > > This one should be since it is stating current behavior. > > Looks like I got it wrong, its third not second: > > ``` > struct TemplateType(T) { } > alias TemplateAlias(T) = TemplateType!T > void templateFunction(TemplateAlias!T arg) { } > ``` > > Two errors (missed the first, semicolon missing). > So: > > ``` > struct TemplateType(T) { } > alias TemplateAlias(T) = TemplateType!T; > void templateFunction(T)(TemplateAlias!T arg) { } > ``` > Indeed. Thanks, it will be corrected. Do I wait for the next round to do corrections? > > I replied with this so that you had feedback for improving the DIP if other people find it hard to understand. You mean include this in the DIP? In the "Description" section there's an identical example. |
September 07, 2019 Re: DIP 1023--Resolution of Template Alias Formal Parameters in Template Functions--Community Review Round 1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefanos Baziotis | On 07/09/2019 12:58 AM, Stefanos Baziotis wrote: > Thanks Mike and jmh530. > > On Friday, 6 September 2019 at 12:48:34 UTC, rikki cattermole wrote: >> >> This one should be since it is stating current behavior. >> >> Looks like I got it wrong, its third not second: >> >> ``` >> struct TemplateType(T) { } >> alias TemplateAlias(T) = TemplateType!T >> void templateFunction(TemplateAlias!T arg) { } >> ``` >> >> Two errors (missed the first, semicolon missing). >> So: >> >> ``` >> struct TemplateType(T) { } >> alias TemplateAlias(T) = TemplateType!T; >> void templateFunction(T)(TemplateAlias!T arg) { } >> ``` >> > > Indeed. Thanks, it will be corrected. Do I wait for the next > round to do corrections? Unless Mike says otherwise, yes. >> >> I replied with this so that you had feedback for improving the DIP if other people find it hard to understand. > > You mean include this in the DIP? In the "Description" section there's an > identical example. No. It is for future reference if there is a trend of people finding it hard to follow. |
September 06, 2019 Re: DIP 1023--Resolution of Template Alias Formal Parameters in Template Functions--Community Review Round 1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to rikki cattermole | On Friday, 6 September 2019 at 13:10:49 UTC, rikki cattermole wrote:
>> You mean include this in the DIP? In the "Description" section there's an
>> identical example.
>
> No.
> It is for future reference if there is a trend of people finding it hard to follow.
Ah yes of course, thanks for referencing it.
|
September 06, 2019 Re: DIP 1023--Resolution of Template Alias Formal Parameters in Template Functions--Community Review Round 1 | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stefanos Baziotis | On Fri, Sep 6, 2019 at 2:34 PM Stefanos Baziotis via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > > On Friday, 6 September 2019 at 12:17:11 UTC, rikki cattermole wrote: > > 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. > The issue is that your abstract is wrong. You have missed T For eg.: you have void templateFunction(TemplateType!T arg) { } instead of void templateFunction(T)(TemplateType!T arg) { } |
Copyright © 1999-2021 by the D Language Foundation