On Thursday, 4 December 2014 at 09:25:11 UTC, Walter Bright wrote:
http://wiki.dlang.org/DIP69
Despite its length, this is a fairly simple proposal. It adds
the missing semantics for the 'scope' storage class in order to
make it possible to pass a reference to a function without it
being possible for it to escape.
Looks pretty solid, but I have one question based on the
following two statements:
1) "Scope is inferred for function parameters if not specified,
under the same circumstances as pure, nothrow, @nogc and safety
are inferred."
2) "Scope is covariant, meaning it can be added to overriding
functions."
How would this be handled in the current proposal?
class C
{
int bar(ref T); // <-- inferred to be scope
}
class D : C
{
override int bar(ref T); // <-- inferred to be NOT scope (but
cannot remove scope when overriding)
}