|
|
|
|
|
by saghm
3312 days ago
|
|
Having never used Swift, it feels like the syntax is being optimized for the less-common case; are named parameters considered the "default" choice in Swift, and is using different external names so common that it's worth cluttering the syntax for functions without external parameters in order to make the their own syntax easier? |
|
The internal/external name divide often works out beautifully. For example, let's equip Double with a multiply-add. An idiomatic Swift signature:
Erase punctuation and you have: The caller sees an action (multiply by, adding), the callee sees nouns (multiplier, summand). It's fantastically readable.