On Tuesday, 9 December 2014 at 22:24:51 UTC, Walter Bright wrote:
front() should return a 'scope ref string'.
That seems to contradict your other statement:
A 'scope ref' parameter may not be returned as a 'ref' or a
'scope ref'.
Just make it a 'ref' parameter.
Please check `foo()` once more - it needs to accept scope
(ref) to be able to
accept ByLine.front as an argument. And it also needs to pass
it down the call
chain - but returning `input` by reference is illegal
according to
abovementioned rule.
It can still be passed down as a 'ref' parameter.
But as far as I understand the spec it will result it this code
failing too:
auto r = ["aaa", "bbb", "ccc"].map!foo;
// should compile but will fail because foo returns scope ref:
string s = r.front;
What I mean is that in current proposal it is impossible to
transfer scope information down the call chain - either function
always returns scope ref or never. Which implies the necessity of
something like `auto scope`...