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

Dukc via Digitalmars-d digitalmars-d at puremagic.com
Mon May 29 08:41:17 PDT 2017


On Monday, 29 May 2017 at 15:31:26 UTC, WebFreak001 wrote:
> well for the extension functions I wrote that if the ref 
> parameter is the first argument and it's called with ufcs 
> syntax, it could implicitly add the ref probably. I don't think 
> there are any big issues with that, it does look like a member 
> function and the programmer could easily read it as "this 
> modifies it"

Surely better than just requiring ref everywhere. But still, 
a.swap(b) just feels intuitive. Hard to say what I like here, 
because the ref parameter is usually the first anyway. Besides 
swap() you rarely use more than one ref parameter.


More information about the Digitalmars-d mailing list