DIP 88: Simple form of named parameters

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Sat Jan 23 08:22:41 PST 2016


On 2016-01-23 16:34, tcak wrote:

> Without making things any complex, the simplest thought of mine is:
>
> Keep everything same. But allow caller to put name of parameter front
> its value wherever desired.
>
> Let's say,
>
> Rect createRect(int x, int y, int width, int height);
>
> So you could call it like:
>
> createRect( 10, 20, width: 200, height: 500 );

I think that the DIP clearly states why it doesn't work like the above. 
One of the big objections of previous proposals was that the parameters 
of existing functions would be come part of the API. That is, it would 
not be possible to rename a parameter without breaking the API.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list