Re: Module function conflicting with reserve function

2018-11-07 Thread Peter Campbell via Digitalmars-d-learn
On Tuesday, 6 November 2018 at 21:29:17 UTC, Stanislav Blinov wrote: On Tuesday, 6 November 2018 at 21:19:29 UTC, Peter Campbell wrote: Given your second example that makes me think that, because object functions are provided by the runtime without me explicitly importing it, this is likely o

Re: Module function conflicting with reserve function

2018-11-06 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 6 November 2018 at 21:19:29 UTC, Peter Campbell wrote: Given your second example that makes me think that, because object functions are provided by the runtime without me explicitly importing it, this is likely only an issue for object functions? Or can this behaviour happen with a

Re: Module function conflicting with reserve function

2018-11-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/6/18 4:19 PM, Peter Campbell wrote: On Tuesday, 6 November 2018 at 21:03:01 UTC, Stanislav Blinov wrote: It's not a bug, just the way name resolution works. Better have collision than silent overloads. Possible solutions: ``` void reserve(ref Bob system, in size_t capacity) { // exp

Re: Module function conflicting with reserve function

2018-11-06 Thread Peter Campbell via Digitalmars-d-learn
On Tuesday, 6 November 2018 at 21:03:01 UTC, Stanislav Blinov wrote: It's not a bug, just the way name resolution works. Better have collision than silent overloads. Possible solutions: ``` void reserve(ref Bob system, in size_t capacity) { // explicitly disambiguate object.reserve(sy

Re: Module function conflicting with reserve function

2018-11-06 Thread Stanislav Blinov via Digitalmars-d-learn
Sorry, forgot to put the spec link into my previous resonse: https://dlang.org/spec/function.html#overload-sets

Re: Module function conflicting with reserve function

2018-11-06 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 6 November 2018 at 20:40:11 UTC, Peter Campbell wrote: Hi there. I've been playing with D and have encountered this really awkward behaviour. Basically I'm getting a compiler error inside a function I wrote in my module as it thinks I'm trying to call itself with invalid parameters,

Module function conflicting with reserve function

2018-11-06 Thread Peter Campbell via Digitalmars-d-learn
Hi there. I've been playing with D and have encountered this really awkward behaviour. Basically I'm getting a compiler error inside a function I wrote in my module as it thinks I'm trying to call itself with invalid parameters, when actually I want it to call the reserve function on the array