Would like to see ref and out required for function calls

David Piepgrass qwertie256 at gmail.com
Thu Sep 13 08:47:45 PDT 2012


> I really think that optionally allowing ref and out at the call 
> site is more
> damaging than beneficial. _Requiring_ it could be beneficial, 
> since then you
> know that the arguments are being taken by ref, but if it's 
> optional, it gives
> you a false sense of security and can be misleading.

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.

I think it would be nice to have it required, but it's very bad 
to break everyone's code. It could only be reasonably enforced 
with a compiler switch--or, wait, come to think of it, a pragma 
would probably be better way to introduce language changes like 
this:

module foo;
pragma(callSiteRef);
// and would it make sense to offer an alternative to -property 
too?
pragma(property);

Now you can tell whether a program uses ref/out religiously or 
not.


More information about the Digitalmars-d mailing list