On 06/11/2011 10:05 PM, Walter Bright wrote:
On 6/11/2011 12:58 PM, Andrei Alexandrescu wrote:
On 6/11/11 1:59 PM, Michel Fortin wrote:
On 2011-06-11 13:08:48 -0400, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> said:

With named parameters, we'd have something along the lines of:

topNIndex(a, sortOutput : true);

which is nice, but not present in the language (and I can tell after
talking to Walter it won't be anytime soon).

The funny thing is that named arguments are not that difficult to
implement as long as you don't allow reordering. Much easier than
const(Object)ref actually.

<https://github.com/michelf/dmd/commit/673bae4982ff18a3d216bc1578f50d40f4d26d7a>



Took
me less time than what I took arguing about Flag!"".

Love the attitude!! Let's see what Don and Walter think.

I think it's clever and insightful how Michel's solution is implemented.
It does not allow, however, for named arguments to be not in the same
positions as unnamed ones.

In other words, unlike struct field initializations, named arguments
cannot appear in any order. I think people will find it an odd difference.

If we all get convinced that named parameters are worth it, I'm convinced Michel would be sufficiently motivated to address this limitation. I personally am lukewarm regarding the feature but I think many people would find it quite convenient.

Andrei

Reply via email to