On Monday, 20 August 2018 at 09:31:09 UTC, Atila Neves wrote:
On Friday, 17 August 2018 at 13:39:29 UTC, Steven Schveighoffer
wrote:
// used to be scope int* ptr() { return ints; }
scope inout(int)* ptr() inout { return ints; }
Does scope apply to the return value or the `this` reference?
I assumed the return value. I think I've read DIP1000 about a
dozen times now and I still get confused. As opposed to `const`
or `immutable`, `scope(T)` isn't a thing so... I don't know?
What usually happens is that qualifiers to the left of the name
apply to the return type and those to the right apply `this`. Not
that that _should_ make any difference since lifetime ints ==
lifetime this
What happens if you remove the return type? (i.e. scope auto)
And write what instead?
scope ptr() inout { return ints; } ?