transporting qualifier from parameter to the return value

Eldar Insafutdinov e.insafutdinov at gmail.com
Wed Dec 16 05:47:32 PST 2009


Walter Bright Wrote:

> 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
> }

OMG, D is slowly becoming C++



More information about the Digitalmars-d mailing list