A nice way to step into 2012

Timon Gehr timon.gehr at gmx.ch
Wed Dec 28 12:44:01 PST 2011


On 12/28/2011 09:25 PM, Jonathan M Davis wrote:
> On Wednesday, December 28, 2011 15:57:42 Andrej Mitrovic wrote:
>> I can understand how Jonathan has no problem writing verbose code, but
>> I'd rather not have to write enums all over the place just to use a
>> true/false flag that is obvious at the call site compared to calls
>> like this:
>>
>> showWidget(true, false);
>
> I'm not a big fan of the enum's for true/false either. I have no problem
> whatsoever with the above line of code. I'd much rather have that than named
> arguments.
>
> The primary reason that I really don't like named arguments is the fact that
> the names of the parameters become part of the API.

That assumes every parameter is implicitly named. If named arguments 
ever get into the language, then they should imho be marked as named 
arguments explicitly at function declaration point.

> I also don't think that they add much unless you have functions with way too many parameters, and
> those sorts of functions shouldn't be happening anyway. And I don't like the
> additional complication of the possibility of reordering functiion arguments.
> You should be able to look at a function and know which parameters its
> arguments go with purely by the order, which named arguments destroy.

Why would that be beneficial?

>
> But all of that has been discussed at length before. I'm completely opposed to
> the idea, but I seem to be in the minority (at least out of those who spoke
> up).
>
> - Jonathan M Davis

I don't need named arguments either, but I don't think they would hurt 
if implemented as a purely optional feature.


More information about the Digitalmars-d mailing list