DIP 88: Simple form of named parameters

Andrej Mitrovic via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 24 03:16:19 PST 2016


On 1/24/16, Jonathan M Davis via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> I would strongly argue that anyone who feels the need for named
> parameters should rethink how they're designing their functions.

Another example where they become useful is with functions that take
source and destination parameters. E.g.:

void copy ( Buffer src, Buffer tgt ) { }

vs

void copy ( Buffer tgt, Buffer src ) { }

With regard to param names being part of the API I think that:

- Parameter names very rarely change
- It's the responsibility of the client code authors to fix any code
breakage due to parameter renaming

I think the best thing we can do before completely dismissing this
idea is to look into the experience of other programming communities
(like Python) and try to weigh the pros vs the cons.


More information about the Digitalmars-d mailing list