Function with default parameters

Jacob Carlborg doob at me.com
Sat Sep 18 03:14:34 PDT 2010


On 2010-09-18 00:37, Mariusz Gliwiński wrote:
> I just could promise I've seen in D2 something like in scripting languages:
>
> module test;
>
> void main (string[] args) {
> test(b = "test");
> }
>
> void test(string a = "a", string b = "b", string c = "c") {
> }
>
> Basically picking just right parameter while other have default. But now
> I can't find syntax anywhere. This code didn't worked, could you refresh
> my memory?
>
> Thanks,
> Mariusz Gliwiński

I have a simple implementation of named arguments here: 
http://dsource.org/projects/orange/browser/orange/util/Reflection.d 
search for "callWithNamedArguments".

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list