Re: passing member.member alias to mixin template

2017-09-03 Thread Eric_DD via Digitalmars-d-learn
Clear explanation, thanks! I think it would avoid a lot of confusion to disallow the alias f = c1.field notation and only allow the alias f = C.field notation. If necessary one could use alias f = typeof(c1).field

Re: passing member.member alias to mixin template

2017-09-03 Thread ag0aep6g via Digitalmars-d-learn
On 09/03/2017 08:54 PM, Eric_DD wrote: *** This works: struct Array { void foo() { writeln("foo"); } } mixin template arrayOperations(arrays...) { void foo() { foreach(ref a; arrays) a.foo(); } } class Thing { Array data1; Array data2; mixin arrayOperatio

passing member.member alias to mixin template

2017-09-03 Thread Eric_DD via Digitalmars-d-learn
I am running into something that seems a bit inconsistent. When I pass an alias of a member to a mixin it works, but a member to member doesn't. It seems like the alias is evaluated to the last symbol before passing it to the mixin. If that's true, is there a way to defer the evaluation? Any