`return const` parameters make `inout` obsolete
Zach the Mystic via Digitalmars-d
digitalmars-d at puremagic.com
Mon Mar 16 11:46:10 PDT 2015
On Monday, 16 March 2015 at 16:49:36 UTC, ketmar wrote:
> having argument modifier that changes function return type is
> very
> surprising regardless of how much people used to it. really,
> why should i
> parse *arguments* to know the (explicitly specified!) *return*
> *type*?
> it's ok with `auto`, it's ok with `inout`, but when i wrote
> `char *`, i
> want `char *`. and then compiler decides that it knows better.
> ok,
> compiler, you win, can you write the rest of the code for me?
> no? stupid
> compiler!
I feel like you're reacting more to "Change" than to my actual
point. `inout` wasn't invented because it looks good, but because
it solves the DRY problem for different input types. `return`
parameters also solve that problem, plus a few more, and with
less DRY even than `inout`. I don't think either type if
signature is that hard to read. It's just a matter of getting
used to them.
More information about the Digitalmars-d
mailing list