A nice way to step into 2012

Timon Gehr timon.gehr at gmx.ch
Wed Dec 28 14:48:54 PST 2011


On 12/28/2011 11:34 PM, so wrote:
> If you change "anything" in your interface, it is already a breaking
> change.

That is why it is desirable to not let parameter names contribute to the 
interface. Jonathan definitely has a point against making all parameters 
named parameters by default.

 From a recent thread in D.learn:

Christophe wrote:
> Timon Gehr wrote:
>> but the drawback is that the parameter names become part of the
>> public interface.
>
> Well, that's precisely the point. And it is a drawback if parameters are
> systematically names, but not if it is triggered only on demand.
>
> Example :
>
> void foo(int a, int b:, int c:);
>
> void main() {
> 	foo(1, 2, 3);
> 	foo(1, c: 3, b: 2;
> 	foo(a: 1, b: 2, c: 3); // error : a is not a named parameter.
> }
>
> In the example, ":" is used to make a named parameter to recall the use
> when you call the function.

I thought that was pretty convincing.


More information about the Digitalmars-d mailing list