DIP 88: Simple form of named parameters

Chris Wright via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 24 10:55:40 PST 2016


On Sun, 24 Jan 2016 10:14:53 +0000, default0 wrote:
> So given this method:
> void M(int a, int b = 1, int c = 2, int d = 3, int e = 4, int f =
> 5, int g = 6, int h = 7, int i = 8)
> {
> }
> 
> You prefer calling it this way:
> M(5, 1, 2, 3, 4, 5, 6, 7, 23);
> As opposed to:
> M(5, i: 23);

Actually, the proposal doesn't allow the latter. It explicitly doesn't 
allow you to change the order of parameters and says nothing about 
allowing this as a special case, so you would have to write it as:

M(5, b: 1, c: 2, d: 3, e: 4, f: 5, g: 6, h: 7, i: 23);

Which is slightly more readable but still a nightmare for maintainability.


More information about the Digitalmars-d mailing list