Pretty please: Named arguments
Max Samukha
spam at spam.com
Tue Mar 1 04:52:07 PST 2011
On 01.03.2011 13:20, spir wrote:
> I'm fed up with people opposing to features very relevant for code
> clarity, which they are not forced to use, and can hardly bother when
> reading code themselves. Is the second statement below really that hard
> to read?
> p = new Point([1,2,3], [3,2,1]);
> p = new Point(color:[1,2,3], pos:[3,2,1]);
I hate that "explicitness improves code clarity and readability"
argument. It may be true in some cases but most of the time explicitness
creates unnecessary redundancy that actually impairs readability. Add a
couple more Point instances with explicitly specified argument names and
you will have useless and annoying noise.
Named arguments are definitely useful when one needs to avoid specifying
default parameter values but I still think we can live a happy life
without them. At least until D3.
More information about the Digitalmars-d
mailing list