A nice way to step into 2012

Jonathan M Davis jmdavisProg at gmx.com
Wed Dec 28 12:25:27 PST 2011


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. 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.

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


More information about the Digitalmars-d mailing list