Pretty please: Named arguments

spir denis.spir at gmail.com
Mon Feb 28 12:07:50 PST 2011


On 02/28/2011 08:01 PM, Bekenn wrote:
> On 2/28/11 5:59 AM, spir wrote:
>> +++ Make things simple!
>> Since positional arguments is the main & historic parameter-passing
>> method, just keep order.
>
> I think that would remove a huge chunk of the utility of having named
> arguments, and it doesn't make things easier at all from the compiler's
> perspective.
>
> Consider:
>
> Declaration:
> void func(int a = 0, int b = 1);
>
> Call:
> func(b: 3); // a is default
>
> Since b in the call is not in the same position as specified in the declaration
> (position 0 instead of position 1), the compiler already has to ignore the
> positioning of named arguments.

Yes, you are right on this. But it's because there is a confusion between 
default and optional parameter, no?

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list