|
|
|
|
|
by masklinn
3822 days ago
|
|
> Can you explain what "and require using when just wanting positional-only parameters, or consistently labelled parameters" means? I don't understand that. As far as I can see (and the article notes), by default the first parameter of a Swift function is unlabelled, and the others are labelled. That is at callsite the first parameter can not be labelled and the others must be. Having either all-positional or all-labelled (but still positional) requires specifying external names. > As for why you have it in the first place, it's just because one is API and one is implementation But again and as you yourself noted that could trivially be done with local bindings inside the function in cases where it's desirable. |
|
As for "that could trivially be done," that applies to a lot of language features in a lot of languages. Virtually all language features are redundant in that fashion, yet they can still be useful by adding brevity and clarity.