Would like to see ref and out required for function calls

Jonathan M Davis jmdavisProg at gmx.com
Thu Sep 13 09:48:11 PDT 2012


On Thursday, September 13, 2012 17:47:45 David Piepgrass wrote:
> It gives *who* a false sense of security? If it's optional then I
> *know* lack of ref/out doesn't imply that the parameter won't
> change. Only people who don't know the rules would have this
> false sense of security.

More like anyone reading the code but especially when someone _other_ than you 
is reading your code. I'd fully expect that there would be quite a few 
programmers who would assume that the lack of ref at the call site would mean 
that it's not passed by ref when the code uses ref and out at the call site 
all over the place.

And because the lack of ref or out at the call site means nothing, you're 
always going to have to either know whether the function takes its arguments 
by ref or not, or you're going to have to look up the function anyway. And if 
that's the case, actually using ref or out at the call site buys you almost 
nothing.

- Jonathan M Davis


More information about the Digitalmars-d mailing list