Should out/ref parameters require the caller to specify out/ref like in C#?

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Sun May 28 16:40:58 PDT 2017


On Sunday, May 28, 2017 17:54:30 WebFreak001 via Digitalmars-d wrote:
> I think the user should be enforced to use foo(ref input) instead
> of foo(input) as it greatly increases understanding of the code
> on the caller side and another advantage is that programs
> analyzing the AST can better understand if the argument is unused
> (DScanner could use this for example).

This has been discussed before. Among other things, it does not play nicely
with UFCS or generic code (both of which are huge in D). If you really want
to have it show at the call site that you're not simply passing by value,
then use a pointer.

- Jonathan M Davis



More information about the Digitalmars-d mailing list