Not initialized out argument error
Kapps via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 17 05:04:02 PDT 2014
C# forces you to set a default value for out parameters, and I
personally find it annoying. The very nature of out parameters is
often that you use it in a situation where there *may* be a
result. Again using a C# example, 'bool
Dictionary.TryGetValue(key, out foo)'. I don't care what the
value of foo is if that returns false, yet the method still has
to manually initialize it to what that particular implementation
feels like (which is not guaranteed to be any particular value).
I prefer D's approach where you have a guaranteed value that it
gets default initialized to, and don't have to manually
initialize it to some value if it doesn't make sense to assign a
value.
More information about the Digitalmars-d
mailing list