DIP6: Attributes

Steven Schveighoffer schveiguy at yahoo.com
Tue Aug 4 11:50:48 PDT 2009


On Tue, 04 Aug 2009 14:46:34 -0400, Ary Borenszweig <ary at esperanto.org.ar>  
wrote:

> Steven Schveighoffer wrote:
>> On Tue, 04 Aug 2009 13:44:46 -0400, Ary Borenszweig  
>> <ary at esperanto.org.ar> wrote:
>>
>>> Andrei Alexandrescu wrote:
>>>> Steven Schveighoffer wrote:
>>>>> What I'd like to see is something like this possible:
>>>>>
>>>>> void foo (int timeout, string bar, float f = 4.0);
>>>>>
>>>>> void foo(int timeout);
>>>>>
>>>>> call!(foo)("timeout=5,bar=\"hello\"");
>>>>>
>>>>> Taking into account the default value of f, what the parameters are  
>>>>> named, and which overload to call.  I could certainly do it with C#.
>>>>  This is interesting. It means we'd need reflection for parameter  
>>>> names, which currently does not exist.
>>>
>>> Why do it with strings? Why not
>>>
>>> call!(foo)(5, "hello")
>>>
>>> with varaidic args?
>>  Ok, say foo is:
>>  void foo(string bar, int timeout)
>
> What's the difference?

The difference is, I'm saying I want to call foo with parameters  
identified by parameter name, not parameter order.

-Steve




More information about the Digitalmars-d mailing list