Would like to see ref and out required for function calls

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Sep 7 07:38:11 PDT 2012


On 9/7/12 1:34 PM, Kevin McTaggart wrote:
> I've been looking at migrating a reasonably large ship motion library
> (tens of thousands of lines) from C# to D. I've become quite
> enthusiastic about D, and most of my problems have been relatively minor
> (e.g., inconsistent bugs with std.container.Array, would like orange
> serialization to give me an error telling me I didn't register a class
> before calling serialize). I suggest that the language require ref and
> out when calling functions, as C# requires. This would make code easier
> to understand, and would also eliminate the problem I had when the wrong
> function from the following choices was mistakenly called:
>
> parseLineInts(string text, int positionStart, out int j0, out int j1)
>
> parseLineInts(string text, out int j0, out int j1, out int j2)
>
> I note that the second function calls another function as follows:
> int positionStart = 1;
> parseLineInts(text, positionStart, j0, j1, j2);
>
> I look forward to seeing feedback from D experts. This is the only
> significant change that I could think of recommending for the language.

Actually the darndest thing is that C# has retired the syntax in 5.0 (it 
used to be required up until 4.0). Apparently users complained it was 
too unsightly.

Andrei




More information about the Digitalmars-d mailing list