transporting qualifier from parameter to the return value

Walter Bright newshound1 at digitalmars.com
Tue Dec 15 22:06:58 PST 2009


Andrei Alexandrescu wrote:
> Any thoughts would be appreciated.

The more I think about this, the more I think it cannot work unless 
inout is elevated to be a full type constructor, just like const, 
immutable, and shared are.

For example:

inout(char[]) foo(inout char[] p)
{
     char[] s = p;
     return s;      // ulp, doesn't work

     const char[] s = p;
     return s;      // ulp, doesn't work

     immutable char[] s = p;
     return s;      // ulp, doesn't work

     auto s = p;
     return s;      // ulp, doesn't work
}



More information about the Digitalmars-d mailing list