Flag proposal

KennyTM~ kennytm at gmail.com
Sun Jun 19 12:13:27 PDT 2011


On Jun 20, 11 03:03, Nick Sabalausky wrote:
> "KennyTM~"<kennytm at gmail.com>  wrote in message
> news:it8f4s$1gve$1 at digitalmars.com...
>> On Jun 15, 11 00:45, so wrote:
>>> On Tue, 14 Jun 2011 15:18:09 +0300, KennyTM~<kennytm at gmail.com>  wrote:
>>>
>>>>> loc.x on the caller side, it has no idea about function signature, and
>>>>> you don't know if it was 10th or 2nd argument in function.
>>>>>
>>>>> // definition
>>>>> fun(int x, int y) {
>>>>> }
>>>>>
>>>>> // call
>>>>> fun(x, y) // you need to check the definition if you think something
>>>>> wrong with parameters the second time you come here
>>>>> fun(y, x) // same
>>>>> fun(x:x, y:y) // you know there is nothing wrong with parameters
>>>>> fun(y:y, x:x) // same
>>>>>
>>>>
>>>> If you have no idea about the function signature, you have no idea
>>>> about the parameter names either.
>>>
>>> I think you are just resisting here, if you write a call once with named
>>> arguments, you documented it in place, the next time you visit this call
>>> all you need to see is in the call site.
>>>
>>
>> I'm just bringing up the fact. Why would you need to check the function
>> signature when reading
>>
>>      MoveWindow(hWnd, loc.x, loc.y, myWin.width, myWin.height,
>>                 bRepaint:true);
>>
>> ? It's clear what each argument does.
>
> Because it might be wrong.
>
>
>> If you feel the need of duplicating the same information, fine, write
>>
>>      MoveWindow(hWnd:hWnd, X:loc.x, Y:loc.y,
>>                 nWidth:myWin.width, nHeight:myWin.height, bRepaint:true);
>>
>> in your code. But don't make it mandatory, it's a waste of time and space
>> when the writer just wants to clarify that 'true' is a bRepaint.
>>
>
> I don't think anyone suggested named arguments should be manditory.
>

Right, no one suggested named arguments should be mandatory, but @so's 
original suggestion is either "all on" or "all off", which makes this 
example pretty much mandatory because of a 'bRepaint: true'.


More information about the Digitalmars-d mailing list