On 01/03/11 18:25, Jonathan M Davis wrote:
On Monday 28 February 2011 23:24:00 Steven Wawryk wrote:
On 01/03/11 08:08, Don wrote:
2. It introduces a different syntax for calling a function.
foo(4, 5);
foo(x: 4, y: 5);
They look different, but they do exactly the same thing. I don't like
that redundancy.

So, out of consistency, I suppose you must be against foreach,
scope(exit) and every other kind of lowering?

Except that they actually do something different. All adding the variable names
really do in this case is document the name of the variable that each argument
is tied to and enforce that the names you give are valid. While it does allow
for some increased flexibility in cases where a function takes multiple default
arguments, for the most part it's just documentation. For the most part, it's
not actually doing anything for you. It's not even syntactic sugar.

Now, obviously there are a number of people here who think that this compiler-
verified documentation is worth having, but for the most part, that's all this
is. It's not cutting down on boiler plate code or reducing how much you have to
type to do a particular type of operation (in fact, it's increasing it). So,
this is not at all comparable to foreach or scope or other features which use
lowering to transform code. At most, this results in the re-ordering of
arguments. It's a totally different type of feature.

Really, named arguments are compiler-enforced documentation which allow you to
do a couple of things that you wouldn't be able to do normally (re-order
arguments and give arguments for parameters with default arguments without
giving arguments for parameters earlier in the parameter list which have default
arguments). They're not really anything fancier than that. So, they're not
really comparable to foreach or scope statements. In my opinion (and Don's it
seems), they just don't pull their weight, unlike features such as foreach and
scope statements. We appear to be outnumbered however.

- Jonathan M Davis


Weight-pulling is the crux of the whole matter, and it is a highly subjective judgement.

My comment was in response to "They look different, but they do exactly the same thing. I don't like that redundancy.". I was highlighting that redundancy like that is not in and of itself a bad thing. D uses it extensively and, as long as it's not frivolous, it contributes a great deal to the usability of the language.

Back to the subjective judgement, it appears to me that the majority of people participating in this thread believe that the compiler-enforced documentation it provides *does* pull its weight.

Reply via email to