`return const` parameters make `inout` obsolete

ixid via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 17 11:27:00 PDT 2015


> To be fully viable, `return` would have to be secretly recorded 
> as part of the `x's type, so that the compiler could forgive 
> returning it to a non-const. But the compiler should probably 
> track that `x` is copied from `t` anyway, so that it can verify 
> `return t` when it returns `x`, and the same information would 
> be used to forgive `x's constness.
>
> But yeah, there might still be a use for `inout`.

Why is this ability important? It feels like trying to distort 
non-templates into templates. Is this the alternative to using 
templates or repeating yourself or are there other important 
aspects to it?


More information about the Digitalmars-d mailing list