--- Comment #18 from Jonathan M Davis <> 2011-08-07 00:39:42 
PDT ---
And why would it matter that the function was ref instead of out? It's still
affecting the variable that's passed in either case. The fact that it's ref now
instead of out has no effect on the calling function. It could change out to
ref or ref to out without having any effect on what the function did
whatsoever. What _does_ have an effect is that the behavior of the function
changed, and it can do that without changing its signature at all.

Of bigger import would be if it changed ref or out to non-ref or if it changed
non-ref to ref or out. Changing ref or out to non-ref would be caught, but
changing non-ref to ref or out wouldn't, because ref and out aren't required at
the call site. And yes, assuming that the function's behavior changed when the
argument was changed to non-ref, the compiler will have caught it. That is of
some value, but since it's so easy to change a function's behavior without
changing its signature, and since it's probably fairly rare for a function to
change whether it takes an argument by ref or not, it's probably not going to
catch much in the way of bugs. It will catch a bug periodically, but given that
it gives a false sense of security about what is and isn't actually being
passed by ref (since ref and out aren't required at the call site and you
really can't know whether an argument wich doesn't have ref or out really is
being passed by value or not) and that it's probably not going to catch bugs
very often, I'd still argue that it's too minor an advantage to merit changing
the language.

I think that the feature would be of much more value if it were required, but I
_really_ doubt that that would fly at this stage in the game, since it's a
breaking change, and while it might be nice to know at a glance whether an
argument is being passed by ref or not, I don't think that it's worth being
forced to use ref and out every time that you have an argument being passed by
ref or out.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to