Friends don't let friends use inout with scope and -dip1000

Kagamin spam at here.lot
Tue Aug 21 13:42:31 UTC 2018


...except for templated functions:

int[] escape(scope int[] r)
{
     return r; //error, can't return scoped argument
}

int[] escape(return int[] r)
{
     return r; //ok, just as planned
}

int[] escape(return scope int[] r)
{
     return r; //ok, `return scope` reduced to just `return`
}

int[] escape(T)(scope int[] r)
{
     return r; //ok! `scope` silently promoted to `return`
}

You can't have strictly scoped parameter in a templated function 
- it's silently promoted to return parameter. Is this intended?


More information about the Digitalmars-d mailing list