|
|
|
|
|
by skohan
2074 days ago
|
|
Have you worked with Swift at all? Because the features you're complaining about aren't really difficult to understand in practice, and they're a major part of what makes Swift really clear and nice to work with. > Keywords? Or parens? Both! Why should they be mutually exclusive? Swift's named parameters are great! For instance they allow for default parameters, which is something I really miss in Rust for instance where I have to use the builder pattern everywhere. > And the weird case of having two keywords, one with a colon and one without, because we decided to make the keywords the names of the parameters. Sometimes. Swift's rules for parameter naming are very simple, consistent, and easy to understand. Given the signature: func foo(first second: Type)
`first` is the name used outside of the function, or the keyword for this argument, and `second` is the name used inside the function, or the parameter name. If the two names are the same, the second name can simply be elided. So for instance this signature: func foo(x: Int)
Is just syntactic sugar for this: func foo(x x: Int)
It's super simple and something which every swift developer can pick up within minutes of starting their first tutorial. I don't really understand why you seem to getting so agitated over this non-issue. |
|
Yes, regretfully.
>> Keywords? Or parens? Both!
> Why should they be mutually exclusive?
Because of parsimony. The comment I was replying to made the claim that the original Swift design war parsimonious. It wasn't.
> Swift's named parameters are great!
Named parameters are great. Swift's implementation of named parameters is deficient, and not parsimonious. Yes, even that design is better than not having named parameters, but once you have named parameters, you don't need the parens.