Keyword arguments / Named parameters library implementation

Matthias Walter xammy at xammy.homelinux.net
Mon Mar 19 10:21:21 PDT 2012


Hi,

I've written a small module (at the moment called utils.keywordargs)
which simulates keyword arguments (aka named parameters). The
documentation can be found here,

http://xammy.xammy.homelinux.net/~xammy/utils_keywordargs.html

while the code is at

http://xammy.xammy.homelinux.net/~xammy/keywordargs.d

or in a better readable format: http://pastebin.com/AfqKKziW


There was some discussion about introducing them in the language a while
ago. One argument against keyword arguments was that the names become
part of the interface. This wouldn't be different when using my
implementation, but as the names are compile-time strings, handling
different versions of a library is just a matter of putting the right
string constant into the keyword argument template.

Any comments? Is something like that interesting for phobos? If yes, I'd
suggest to put it on github to make further work easier.

Best regards,

Matthias



More information about the Digitalmars-d mailing list