On 6/10/11 9:47 PM, Nick Sabalausky wrote:
I completely agree with Robert and Michel on all the points they've raised.
Flag is admittedly a great example of the power of D's templates. And it's
admittedly a very clever hack to get around *some* of the limitations of not
having named parameters...*But* it's *still* just that: a hack to get around
some of the limitations of not having named parameters. And yes, it is
comparatively ugly, as Robert and Michel's examples have very clearly shown.

Also:

The problem that named parameters are still optional remains. Or we need
to add one extra language feature to specify required named parameters.

If by that, you meant that the caller is allowed to call the function
without naming the parameters, I really don't see that as a problem. Yea,
*maybe* it would be better if the callee could optionally decide "caller
must use named params", but even without that, it's a hell of a lot better
than the current state, and it's also a lot better than Flag becase 1. It's
*much* cleaner for both the caller and callee, and 2. It works for functions
like foo(int, int, int, int), not just bools.

That quite accurately summarizes the reason for my short »I'm not really sure what to think about this – […] named parameters would be the better solution« comment on the pull request; full ack.

David

Reply via email to