Flag proposal

Nick Sabalausky a at a.a
Mon Jun 13 22:32:59 PDT 2011


"so" <so at so.so> wrote in message news:op.vw1msqy0mpw3zg at so-pc...
> On Tue, 14 Jun 2011 04:46:54 +0300, Ary Manzana <ary at esperanto.org.ar> 
> wrote:
>
>> On 6/14/11 8:36 AM, so wrote:
>>> On Mon, 13 Jun 2011 20:19:15 +0300, bearophile <
>>> <bearophileHUGS at lycos.com> wrote:
>>>
>>>> Andrei:
>>>>
>>>>> If we all get convinced that named parameters are worth it,
>>>>
>>>> I think this is not going to happen because some people (two?) don't
>>>> want this feature.
>>>
>>> I think they worth it and it is the right time to talk extensively why
>>> people think they don't.
>>> And reasoning should not be about its failure or success in another
>>> language, we better have our own rules.
>>>
>>> IMO named arguments in D at least should do:
>>>
>>> - Reordering (since we got default parameters, even better)
>>>
>>> - It is enabled only if we have access to the function declaration.
>>>
>>> - In a function call we either use named arguments for all the
>>> non-default arguments or call it with the usual syntax. No hybrid stuff,
>>> no confusion.
>>
>> A different rule can be:
>>   - Named arguments come last.
>>   - Any previous arguments match the order.
>
> IMO the main that makes NAs confusing is allowing hybrid calls.
> I don't think allowing reordering then introducing two new rules on 
> ordering is a good idea.

I think Ary's suggestion is very simple and easy to understand. Hybrid calls 
are *only* confusing when an unnamed parameter comes after a named one.





More information about the Digitalmars-d mailing list