Pretty please: Named arguments

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Tue Mar 1 03:48:29 PST 2011


On Tue, 01 Mar 2011 12:20:22 +0100, spir wrote:

> On 02/28/2011 11:13 PM, Steven Schveighoffer wrote:
>>> But I still don't see the need for this feature. Aren't people using
>>> IDEs where the function signature (with parameter names) pops up when
>>> you're entering the function, and when you move the mouse over the
>>> function call?
> 
> You are wrong Don, this is not an argument. The feature is *not* for
> writing code, but for reading it (first your own code). Obviously, if
> you can write parameter names, this means you know them somehow, lol!
> The names provide highly valuable info at /reading/ time.
> 
>> Dunno, vim doesn't do that for me currently.  Also, if reviewing code
>> on github, there is no ide.
> 
> Geany does it, but only for currently open files. Meaning, to have it
> work when programming in D, I should have the whole stdlib open in geany
> tabs... Anyway, as said above, this feature is 'orthogonal' to the
> question discussed in this thread.
> 
> 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]);

Are the following really that hard to read?

  p = new Point(/* color */ [1,2,3], /* pos */ [3,2,1]);

  p = new Point(
        [1, 2, 3],    // color
        [3, 2, 1],    // pos
        );

-Lars


More information about the Digitalmars-d mailing list