DIP6: Attributes

Steven Schveighoffer schveiguy at yahoo.com
Tue Aug 4 13:07:36 PDT 2009


On Tue, 04 Aug 2009 15:56:16 -0400, Ary Borenszweig <ary at esperanto.org.ar>  
wrote:

> Andrei Alexandrescu wrote:
>>  Well some don't like to need to remember the order of arguments.
>
> But that's a way totally different thing discussed here.
>
> First you need to introduce argument names when invoking a function.
>
> void foo(int timeout, string bar) {
>     ..
> }
>
> Can be used as:
>
> foo(timeout=5, bar="100")
>
> (with some other syntax, of course)
>
> Once you have that, you could do:
>
> call!(foo)(timeout=5, bar="100")
>
> Voilà!

It could also be accomplished via a fully implemented reflection library,  
which is my side topic for this thread branch :P

For instance you could do this exact thing in C#, even though C# doesn't  
support named parameters.

-Steve



More information about the Digitalmars-d mailing list