Why can't I give a function's return type the scope storage class?

Walter Bright newshound2 at digitalmars.com
Sat Mar 16 17:59:41 UTC 2019


On 3/15/2019 10:29 PM, Meta wrote:
> Am I wrong in thinking that this is something one would want to do? It seems 
> like it would be useful for the callee to enforce that its return value is 
> assigned to a scope variable.

Scope on function return values comes from the scope of any arguments passed to 
the function marked as 'return scope'. Scope on a function return with no such 
arguments is currently meaningless in D.

To add such a feature, there woul'd need to be compelling use cases.


More information about the Digitalmars-d mailing list