> On Nov 2, 2017, at 7:05 PM, Xiaodi Wu via swift-evolution
> <[email protected]> wrote:
>
> Firstly, because for the proposed use case it's not a "default" parameter in
> that it's not overridable: you can't actually pass another argument.
Sure you can. Remember, you can call an operator with function-call syntax:
(+)(1, 2)
We could allow you to specify the non-default parameters when you need to using
this syntax:
// Normal use:
value !! MyError.missingValue
// With defaulted parameters changed:
(!!)(value, MyError.missingValue, file: someFile, line: someLine)
We could also—as part of a separate proposal, perhaps in a future version of
Swift—explore a more elegant syntax for adding options to operator calls. This
could be useful for things like string comparisons where you need to decide
whether a comparison should be locale-aware, case-sensitive, etc.
// Strawman syntax of possible future expansion:
value !! MyError.missingValue #(file: someFile, line: someLine)
--
Brent Royal-Gordon
Architechies
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution