On Monday, 8 December 2014 at 20:14:23 UTC, Walter Bright wrote:
This would be inconsistent with the rest of the types, where
qualifier on the left affects the symbol.
But I like the idea of:
T scope delegate() dg;
as meaning the scope affects the return type. Is that what you
meant?
No I mean the reverse. Let's make it with const as it is better
understood by everybody, and at the end we discuss grammar, so it
doesn't matter.
const A delegate() a; // A mutable delegate that return a const(A)
A const delegate() a; // A const delegate with a const context
(context is transitive) and return an A.
A delegate() const a; // A mutable delegate with a const context
that return an A.
You have inherently 3 things to qualify when it come to delegate:
the return type, the context and the delegate itself.
Yes, that create an inconsistency in the grammar. On the other
hand, that allow for much more consistency in other aspect of the
language. If consistency is a measure, the proposal is a winner.
Relevant: http://wiki.dlang.org/DIP30