Would like to see ref and out required for function calls
F i L
witte2008 at gmail.com
Sat Sep 8 10:21:03 PDT 2012
On Friday, 7 September 2012 at 11:33:41 UTC, 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.
+1. The fact that a value type is modified should be information
the programmer can see at a glance.
Andrei Alexandrescu wrote:
> 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.
Citation? I'm using C# 5.0 with Visual Studios 2012 on Windows 8
right now and ref/out are still required at the call sight of
functions.
More information about the Digitalmars-d
mailing list