digitalmars.D.learn - alias and UFCS
- ixid (10/10) Jan 24 2017 This code:
- Las (2/14) Jan 24 2017 Submit a bug report then.
- ixid (3/21) Jan 24 2017 I will if it turns out the behaviour is wrong, that's what I'm
- ixid (5/27) Jan 24 2017 Apologies for the extra post - does the alias function count as
- Stefan Koch (3/17) Jan 24 2017 UFCS is only applied if the function if defined at module scope.
- ixid (3/21) Jan 24 2017 Does alias of an existing function count as a new function
- Anonymouse (3/11) Jan 24 2017 I believe UFCS is supposed to only work with top-level functions.
This code: T tFunc(alias F, T)(T n) { n.F; return n; } Produces this error: Error: no property 'F' for type 'int[]' (or whatever type I use). The alias rules for functions seem to be incompatible with UFCS, F(n) works fine. What are the rewrite steps here? Is this necessary or an oversight? Not very uniform function call syntax.
Jan 24 2017
On Tuesday, 24 January 2017 at 13:11:41 UTC, ixid wrote:This code: T tFunc(alias F, T)(T n) { n.F; return n; } Produces this error: Error: no property 'F' for type 'int[]' (or whatever type I use). The alias rules for functions seem to be incompatible with UFCS, F(n) works fine. What are the rewrite steps here? Is this necessary or an oversight? Not very uniform function call syntax.Submit a bug report then.
Jan 24 2017
On Tuesday, 24 January 2017 at 15:57:48 UTC, Las wrote:On Tuesday, 24 January 2017 at 13:11:41 UTC, ixid wrote:I will if it turns out the behaviour is wrong, that's what I'm checking at this stage. =)This code: T tFunc(alias F, T)(T n) { n.F; return n; } Produces this error: Error: no property 'F' for type 'int[]' (or whatever type I use). The alias rules for functions seem to be incompatible with UFCS, F(n) works fine. What are the rewrite steps here? Is this necessary or an oversight? Not very uniform function call syntax.Submit a bug report then.
Jan 24 2017
On Tuesday, 24 January 2017 at 16:27:50 UTC, ixid wrote:On Tuesday, 24 January 2017 at 15:57:48 UTC, Las wrote:Apologies for the extra post - does the alias function count as declared in the same scope as the content of the function? That would be plausible as UFCS refuses to work on functions declared in the same scope. Is this something that could be changed?On Tuesday, 24 January 2017 at 13:11:41 UTC, ixid wrote:I will if it turns out the behaviour is wrong, that's what I'm checking at this stage. =)This code: T tFunc(alias F, T)(T n) { n.F; return n; } Produces this error: Error: no property 'F' for type 'int[]' (or whatever type I use). The alias rules for functions seem to be incompatible with UFCS, F(n) works fine. What are the rewrite steps here? Is this necessary or an oversight? Not very uniform function call syntax.Submit a bug report then.
Jan 24 2017
On Tuesday, 24 January 2017 at 16:41:12 UTC, ixid wrote:On Tuesday, 24 January 2017 at 16:27:50 UTC, ixid wrote:UFCS is only applied if the function if defined at module scope. This to to prevent the meaning of a ufcs function from changing.On Tuesday, 24 January 2017 at 15:57:48 UTC, Las wrote:Apologies for the extra post - does the alias function count as declared in the same scope as the content of the function? That would be plausible as UFCS refuses to work on functions declared in the same scope. Is this something that could be changed?On Tuesday, 24 January 2017 at 13:11:41 UTC, ixid wrote:I will if it turns out the behaviour is wrong, that's what I'm checking at this stage. =)[...]Submit a bug report then.
Jan 24 2017
On Tuesday, 24 January 2017 at 20:51:49 UTC, Stefan Koch wrote:On Tuesday, 24 January 2017 at 16:41:12 UTC, ixid wrote:Does alias of an existing function count as a new function definition in that case?On Tuesday, 24 January 2017 at 16:27:50 UTC, ixid wrote:UFCS is only applied if the function if defined at module scope. This to to prevent the meaning of a ufcs function from changing.On Tuesday, 24 January 2017 at 15:57:48 UTC, Las wrote:Apologies for the extra post - does the alias function count as declared in the same scope as the content of the function? That would be plausible as UFCS refuses to work on functions declared in the same scope. Is this something that could be changed?On Tuesday, 24 January 2017 at 13:11:41 UTC, ixid wrote:I will if it turns out the behaviour is wrong, that's what I'm checking at this stage. =)[...]Submit a bug report then.
Jan 24 2017
On Tuesday, 24 January 2017 at 13:11:41 UTC, ixid wrote:This code: T tFunc(alias F, T)(T n) { n.F; return n; } Produces this error: Error: no property 'F' for type 'int[]' (or whatever type I use).I believe UFCS is supposed to only work with top-level functions. I don't remember the rationale behind the decision.
Jan 24 2017