Explicitly saying ref or out when invoking a function

bearophile bearophileHUGS at lycos.com
Tue Aug 11 09:04:45 PDT 2009


Ary Borenszweig:
> What do you think?

I don't know. It's a different design choice. Generally explicit is better and safer, but I don't know much safer this is. Overall I think the C# choice here is a bit better, but you have to write lot of code before being able to tell C# has chosen for the better. 
Another similar design choice is that in C# a method that overrides another one must have the attribute "override", while in D it's optional.

Now in C#4 you can omit the "ref" in the call point if it's a COM type, this leads to tricks:
http://msmvps.com/blogs/jon_skeet/archive/2009/07/07/faking-com-to-fool-the-c-compiler.aspx

Bye,
bearophile



More information about the Digitalmars-d mailing list