Will D ever get optional named parameters?

"岩倉 澪" via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 13 18:46:11 PDT 2014


On Monday, 13 October 2014 at 10:53:50 UTC, ketmar via 
Digitalmars-d wrote:
> if we'll add proper AA literals, they can be used instead. 
> methinks.

I think this would be a decent alternative.

On Monday, 13 October 2014 at 16:08:08 UTC, ponce wrote:
> Work-around I see a lot in C++:
>
> ---------------
>
> bool filled = true;
> drawCircle(filled);
>
> ---------------
>
> instead of:
>
> ---------------
>
> drawCircle(true);
>
> ---------------

This doesn't provide all the benefit of named parameters (in 
particular, their use in combination with default arguments

Other workarounds include associative arrays, and the so-called 
"Named Parameter Idiom" 
http://www.parashift.com/c++-faq-lite/named-parameter-idiom.html


More information about the Digitalmars-d mailing list