816 reputation
1511
bio website
location St. Petersburg, Russia
age
visits member for 3 years, 8 months
seen May 15 at 13:02

This page intentionally left blank.


Nov
7
awarded  Yearling
Oct
2
accepted Using T[1] instead of T for functions overloaded for T(&)[N]
Jun
28
comment Named output parameters vs return values
@Telastyn, well, at call site you don't see parameter names either.
Jun
28
comment Named output parameters vs return values
in handle_message(out bool wasHandled), false value of wasHandled doesn't mean "failure" or "success". It means that there is no need to pass message to next handler. Something like "stop event propagation" if we'd use term "event" instead of "message". As for Windows window messages, DOM events, etc. And yeah, wasHandled has nothing to do with message result and actual message processing. Handler can process message, but return wasHandled == false if it wants to pass the message to a next handler.
Jun
28
comment Named output parameters vs return values
oh, WinForms events. Did you notice that all of them have void return type? Why do you ignore all the events which have output values? E.g. FormClosing, Drag&Drop events, etc?
Jun
28
comment Named output parameters vs return values
In my IDE, you can see comments at declaration, if you move mouse cursor over function identifier at call site.
Jun
27
comment Named output parameters vs return values
@JustinC, side-effect free? Do you mean the process_message and set_value functions? Well yeah, I'd even say it's impossible to make them side-effect free.
Jun
27
comment Named output parameters vs return values
@Bobson, will you make that reply an answer, including different cases of message and event processing, e.g. void processEvent(SomeEvent event, ref string eventResult, ref string otherEventResult, out bool stopEventPropagation) ? Maybe with examples from existing libraries and frameworks.
Jun
27
comment Named output parameters vs return values
@Ingo with tuple<string, string> you have no idea what output values are, or what is their order in tuple.
Jun
27
comment Named output parameters vs return values
When I see bool DoStuff(...) I have no idea what that bool means. Is it "that stuff was good, let's do it again" or "we did enough of that stuff, let's stop" or something else - I don't know. Or maybe it has nothing to do with doing stuff? But with void DoStuff(..., out bool success) or void DoStuff(..., out bool dontDoItAgain) I know what that output value means.
Jun
27
comment Named output parameters vs return values
of course, if function clearly states what it returns, there is no need in named output parameter. E.g. sumOfArray obviously returns a sum. But I'm asking about functions which aren't named after their output values.
Jun
27
comment Named output parameters vs return values
@Bobson please suggest another name.
Jun
27
comment Named output parameters vs return values
Yes. But it often ends with MyFunctionReturnValueType, because you have a lot of different functions with different return types or different meanings of their return values.
Jun
27
comment Named output parameters vs return values
You also don't have parameters and variables called "x" and "y" unless they are coordinates. You have "blueThing", "someEventInformation", etc.
Jun
27
comment Named output parameters vs return values
In real code, functions are not called "f" and "g". They're called "createThingsList", "processThingsList", "adjustThingSize" or "isPlanetWhichCalledEarthFlat". You don't want co compose them.
Jun
27
revised Named output parameters vs return values
deleted 271 characters in body
Jun
27
comment Named output parameters vs return values
@AndresF., nope, that's not my question. my question is "should I use named output parameters instead of unnamed return values with comments with documentation on them"
Jun
27
comment Named output parameters vs return values
@Bobson. yep, we also have the void type for some reason. We also have function and procedure keywords in Pascal, proc in assemblers, and none of them in C++. guess why.
Jun
27
comment Named output parameters vs return values
@AndresF. it's just terminology. E.g. C++ has no "procedures", nor "methods" - only "functions".
Jun
27
comment Named output parameters vs return values
@unholysampler, what do you mean by "bad documentation" - wrong documentation, or lack of documentation, or what?