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

Meta via Digitalmars-d digitalmars-d at puremagic.com
Sun May 28 17:39:17 PDT 2017


On Sunday, 28 May 2017 at 19:10:49 UTC, ketmar wrote:
> Meta wrote:
>
>> If a parameter is marked as ref then you have to assume it 
>> will be modified by the function (unless it's 
>> const/inout/immutable). If it's marked as out then you know it 
>> will be. If you didn't know that the function takes its 
>> parameters by ref or out... You're should've RTFM.
>
> now imagine that you're reading some code:
>
> 	foo(a);
>
> vs:
>
> 	foo(ref a);
>
> which code style is easier to read without constant jumping 
> into documentation?

Is this ever actually a problem in practice?

Anyway, having to add ref or out at the call site will greatly 
hamper metaprogramming.


More information about the Digitalmars-d mailing list