Re: pure opApply

2016-03-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/31/16 10:30 AM, Q. Schroll wrote: On Thursday, 31 March 2016 at 13:51:00 UTC, Steven Schveighoffer wrote: I think it's a bug. foreach and opApply are specially coded in the compiler I think, so there's bound to be inconsistencies between them and normal overload rules. I have never

Re: pure opApply

2016-03-31 Thread Q. Schroll via Digitalmars-d-learn
On Thursday, 31 March 2016 at 13:51:00 UTC, Steven Schveighoffer wrote: I think it's a bug. foreach and opApply are specially coded in the compiler I think, so there's bound to be inconsistencies between them and normal overload rules. -Steve I have never filed a bug report. Should this be

Re: pure opApply

2016-03-31 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/31/16 6:23 AM, Q. Schroll wrote: Simple as that, shouldn't this work? struct X { int opApply(int delegate(string) dg) { return dg("impure"); } int opApply(int delegate(string) pure dg) pure { return dg("pure"); } } void main() { X x;

pure opApply

2016-03-31 Thread Q. Schroll via Digitalmars-d-learn
Simple as that, shouldn't this work? struct X { int opApply(int delegate(string) dg) { return dg("impure"); } int opApply(int delegate(string) pure dg) pure { return dg("pure"); } } void main() { X x; string result; x.opApply(