DIP6: Attributes

Benji Smith dlanguage at benjismith.net
Tue Aug 4 20:20:38 PDT 2009


Frank Benoit wrote:
> Andrei Alexandrescu schrieb:
>> Ary Borenszweig wrote:
>>> call!(foo)(5, "hello")
>>>
>>> with varaidic args?
>> Well some don't like to need to remember the order of arguments.
>>
>> Andrei
> 
> Assigning the argument by name instead of order has two other benefits,
> i can think of...
> 1. on the call side, it is documented for what the given values are used.
> 2. it may be possible to let all parameters have default values and for
> example just give a value for the last parameter. This is not possible
> with just the parameter order.

But these aren't issues with reflection. These are just the same 
function calling rules applied elsewhere in the language:

1) If you want to call a function: you must know its name.

2) If you want to pass parameters: you must know the correct order.

I can't imagine a circumstance where someone uses reflection to call a 
function and knows how to create the correct set of arguments, but 
doesn't know what order to put them in.

--benji



More information about the Digitalmars-d mailing list