`return const` parameters make `inout` obsolete

via Digitalmars-d digitalmars-d at puremagic.com
Mon Mar 16 09:22:44 PDT 2015

On Monday, 16 March 2015 at 14:17:58 UTC, Zach the Mystic wrote:
> char* fun(return const char* x);
> Compiler has enough information to adjust the return type of 
> `fun()` to that of input `x`. This assumes return parameters 
> have been generalized to all reference types. Destroy.

That's a very interesting observation. I never liked the name 
`inout`, as it doesn't describe what it does. The only downside I 
see is that it's more magic, because nothing on the return type 
says its mutability is going to depend on an argument.

I think Kenji also had additional plans for `inout`, related to 
uniqueness. There was a PR. Better ask him whether it's going to 
be compatible.

More information about the Digitalmars-d mailing list