Re: opDispatch and UFCS

2016-05-11 Thread John Colvin via Digitalmars-d-learn
On Thursday, 12 May 2016 at 00:04:43 UTC, Adam D. Ruppe wrote: On Wednesday, 11 May 2016 at 23:46:48 UTC, John Colvin wrote: Bug? Or am I misunderstanding how these two features are supposed to interact? I'm not sure what you actually expected there, but I'd note that in general, opDispatch

Re: opDispatch and UFCS

2016-05-11 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 11 May 2016 at 23:46:48 UTC, John Colvin wrote: Bug? Or am I misunderstanding how these two features are supposed to interact? I'm not sure what you actually expected there, but I'd note that in general, opDispatch will always be preferred over UFCS, just like any other member

opDispatch and UFCS

2016-05-11 Thread John Colvin via Digitalmars-d-learn
struct S { int a; template opDispatch(string s) { template opDispatch(T...) { auto ref opDispatch(Args ...)(auto ref Args args) { return S(mixin(`a.` ~ s ~ (T.length ? `!T` : ``) ~ `(args)`)); } } } }

Re: opDispatch and UFCS

2013-07-02 Thread Artur Skawina
a template } Should the constraint on opDispatch allow the UFCS to call on S? To avoid this kind of issues: struct S { template opDispatch(string s) if (s.startsWith(foo)) { void opDispatch(T...)(T t) { writeln(s); } } } And, yes, the compiler

Re: opDispatch and UFCS

2013-07-02 Thread cal
On Tuesday, 2 July 2013 at 11:04:20 UTC, Artur Skawina wrote: To avoid this kind of issues: struct S { template opDispatch(string s) if (s.startsWith(foo)) { void opDispatch(T...)(T t) { writeln(s); } } } That's a handy workaround,

Re: opDispatch and UFCS

2013-07-02 Thread Kenji Hara
!(to) isn't a template } Should the constraint on opDispatch allow the UFCS to call on S? That's a compiler bug. http://d.puremagic.com/issues/show_bug.cgi?id=10526 Kenji Hara

opDispatch and UFCS

2013-07-01 Thread cal
on opDispatch allow the UFCS to call on S?