On 08/15/2016 02:52 PM, Walter Bright wrote: > On 8/15/2016 2:32 AM, Kagamin wrote: >> On Sunday, 14 August 2016 at 20:02:35 UTC, Walter Bright wrote: >>> auto r = range; >> >> You said that if a value (range in this case) is returned by scope, >> its lifetime >> is restricted to its expression, hence it can't be assigned to a >> variable, >> because the variable outlives the expression. > > A very good question. If the functions parameters are 'return scope', > that means the returned value has the (smallest) scope if its 'return > scope' parameters. If there are no 'return scope' parameters, the scope > of the return value is limited to the expression.
Does that mean that a scope return in aggregate method will bind to
aggregate lifetime if method itself is annotated with scope too? For
example:
struct Container
{
scope Range asRange ( ) scope
{
return Range(&this.data);
}
}
signature.asc
Description: OpenPGP digital signature
