Flag proposal

so so at so.so
Mon Jun 13 23:46:35 PDT 2011


On Tue, 14 Jun 2011 09:18:42 +0300, KennyTM~ <kennytm at gmail.com> wrote:

> I'd rather have no reordering and allow hybrid call. Named argument is  
> useful for specifying the nature of an argument. If the type is clear  
> for all but one argument, the rest is just noisy redundant info.

fun(bool, bool, bool, bool, bool...)
Isn't the type clear for every argument here?

> e.g.
>
>      MoveWindow(hWnd, loc.x, loc.y, myWin.width, myWin.height,
>                 bRepaint:true);
>
> is no worse than
>
>      MoveWindow(hWnd:hWnd, X:loc.x, Y:loc.y,
>                 nWidth:myWin.width, nHeight:myWin.height, bRepaint:true);

Reordering is important an example:

fun(int a, int b=2, int c=3)
If you want to name c but not b what are you going to do?

Named arguments isn't something to save typing.
Also the first version of the MoveWindow indeed worse than the second,  
which again i think requires no explanation.


More information about the Digitalmars-d mailing list