On Jun 14, 11 19:11, so wrote:
[snip]
Also i don't understand why some think allowing hybrid calls has any
merit. Just search "named arguments" and first thing you'd see is calls
with all arguments named, no exception. Allowing unnamed arguments and
named arguments in one call doesn't make any sense to me, it is almost
opposite to the reasons named arguments designed for, you don't even
need to talk about its drawbacks like the complications and confusions.

And if you think it's complicated, you're just thinking in a too complicated way. The rule is simple.

Say there is a function

    pure nothrow
    S parseString(S=const(char)[], C)
       (ref C[] input,
        out ConversionResult result,
        char quote='"',
        bool recognizePrefix=true) if (...);

and you call it as

    string s = `"hello"`;
    ConversionResult detailResult;
auto parsed = parseString(s, recognizePrefix:false, result:detailResult);

The first step is identify all positional arguments ('s' here), and fill them in in-order.

    input <- s
    result <- ...
    quote <- ...
    recognizePrefix <- ...

next, we match the named args

    input <- s
    result <- detailResult
    quote <- ...
    recognizePrefix <- false

finally we fill in the optional parameters

    input <- s
    result <- detailResult
    quote <- '"'
    recognizePrefix <- false

what's so complicated? Actually, reordering creates more complication than hybrid (e.g. ambiguity in selecting an overload).

Reply via email to