`return const` parameters make `inout` obsolete

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Mon Mar 16 09:49:36 PDT 2015


On Mon, 16 Mar 2015 15:54:19 +0000, Zach the Mystic wrote:

> I think it's just less cluttered than `inout`. The simple fact is that
> if you try to assign an immutable variable to a mutable reference, you
> will still get an error. I doubt it would take long for programmers to
> adjust to the new way of reading the signatures. They just see `return`
> sitting there in front of `const` and know how to handle the situation.

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!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150316/aee786f0/attachment.sig>


More information about the Digitalmars-d mailing list