2 bool optional params

Jonathan M Davis jmdavisProg at gmx.com
Wed Nov 10 12:39:15 PST 2010


On Wednesday 10 November 2010 12:24:01 bearophile wrote:
> Jonathan M Davis:
> > In any case, the struct solution is the best that I can suggest for the
> > general case, but really, D doesn't have named parameters. Things just
> > don't work that way.
> 
> Named arguments is among my top four enhancement requests :-) They help.
> Hopefully in D3.

I expect that that's one of those things that those who have never used them 
don't see the point and those who have hate not having them. Personally, I've 
never used a language that had them, and I don't really care about them. I'd say 
that if you have parameter lists long enough to care, then your parameter lists 
are too long and you need to find ways to reduce them (like encapsulating related 
parameters into struct - using a point struct instead of separate x, y, and z 
values would be a great example of that). Maybe my opinion would be different if 
I had extensively used a language with named parameters, but I haven't yet.

Now, that doesn't mean that D definitely shouldn't have them - it could be that 
I'd love them once I had them - but as someone who hasn't used them, they don't 
seem at all necessary. So, I really think that it primarily comes down to people 
not being used to them seeing no need and people being used to them wanting 
them. Whether they are actually worth having, I really can't say.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list