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 itself. Is this a bug or expected behaviour? It seems quite strange and potentially annoying to me.

https://run.dlang.io/is/9YyAI9

module bob;

struct Bob
{
    private ubyte[] _data;
}

void reserve(ref Bob system, in size_t capacity)
{
// bob.reserve(ref Bob system, const(ulong) capacity) is not callable with (ubyte[], const(ulong)).
    system._data.reserve(capacity);
}

void main()
{
}

Reply via email to