Re: isInputRange copied verbatim produces a different result than isInputRange from std.range

2018-03-04 Thread arturg via Digitalmars-d-learn
On Sunday, 4 March 2018 at 21:47:43 UTC, Jonathan M Davis wrote: On Sunday, March 04, 2018 21:03:23 arturg via Digitalmars-d-learn wrote: isn't this what DIP 1005 tried to solve? No. What DIP 1005 was trying to solve was avoiding having to have imports used by your function signature or temp

Re: isInputRange copied verbatim produces a different result than isInputRange from std.range

2018-03-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, March 04, 2018 21:03:23 arturg via Digitalmars-d-learn wrote: > On Sunday, 4 March 2018 at 19:58:14 UTC, ag0aep6g wrote: > > On 03/04/2018 08:54 PM, aliak wrote: > >> wait a minute... so I can't use any std.range functions on a > >> type if I add the range primitives as free functions? O

Re: isInputRange copied verbatim produces a different result than isInputRange from std.range

2018-03-04 Thread arturg via Digitalmars-d-learn
On Sunday, 4 March 2018 at 19:58:14 UTC, ag0aep6g wrote: On 03/04/2018 08:54 PM, aliak wrote: wait a minute... so I can't use any std.range functions on a type if I add the range primitives as free functions? O.o Yes. In other words: You can't implement range primitives as free functions. Bec

Re: isInputRange copied verbatim produces a different result than isInputRange from std.range

2018-03-04 Thread ag0aep6g via Digitalmars-d-learn
On 03/04/2018 08:54 PM, aliak wrote: wait a minute... so I can't use any std.range functions on a type if I add the range primitives as free functions? O.o Yes. In other words: You can't implement range primitives as free functions. Because std.range (and std.algorithm, etc.) doesn't know abo

Re: isInputRange copied verbatim produces a different result than isInputRange from std.range

2018-03-04 Thread aliak via Digitalmars-d-learn
On Sunday, 4 March 2018 at 13:17:30 UTC, Adam D. Ruppe wrote: On Sunday, 4 March 2018 at 12:57:41 UTC, aliak wrote: @property int front(D d) { return 2; } @property bool empty(D d) { return false; } void popFront(D d) {} Those functions are in scope for your function, but not inside std.range

Re: isInputRange copied verbatim produces a different result than isInputRange from std.range

2018-03-04 Thread aliak via Digitalmars-d-learn
On Sunday, 4 March 2018 at 13:17:30 UTC, Adam D. Ruppe wrote: On Sunday, 4 March 2018 at 12:57:41 UTC, aliak wrote: @property int front(D d) { return 2; } @property bool empty(D d) { return false; } void popFront(D d) {} Those functions are in scope for your function, but not inside std.range

Re: isInputRange copied verbatim produces a different result than isInputRange from std.range

2018-03-04 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 4 March 2018 at 12:57:41 UTC, aliak wrote: @property int front(D d) { return 2; } @property bool empty(D d) { return false; } void popFront(D d) {} Those functions are in scope for your function, but not inside std.range. in other words std.range hasn't imported your module, so it

isInputRange copied verbatim produces a different result than isInputRange from std.range

2018-03-04 Thread aliak via Digitalmars-d-learn
Hi, I have a custom type D with front/popFront/empty implemented as free functions, but isInputRange returns false. I copied the implementation of isInputRange, and that custom implementation returns true... anyone know what's going on here? === import std.stdio, std.range, std.traits; // Cod