Would like to see ref and out required for function calls

Minas minas_mina1990 at hotmail.co.uk
Wed Sep 12 06:37:05 PDT 2012


I disagree that it would be useful.
In C# it is useful because pointers that used a lot less than in 
D.

Consider this:

void f(ref int x)
{
...
}

...
int x = 5;
f(ref x); // good, passed by reference
...


But:
void g(int* p)
{
...
}

...
int x = 5;
g(&x); // passed by reference as well, but it is not explicit 
like before. You don't even know if it's a const pointer if you 
don't read the function's signature.
...

So someone has this cool idea which is also present in some other 
programming language and thinks it would be nice to add it to D. 
That's not how it works. Then come the problem with things not 
properly designed etc etc.

Anyway, who needs to see f(ref x) when you can put your mouse 
above the function call and see its declaration? All modern IDEs 
support that - and I don't think C# guys use plain text editors.


More information about the Digitalmars-d mailing list