Hacker News new | ask | show | jobs
by emoII 486 days ago
Something like go, yes. Imo there is benefit to only being able to do things one way, and in swift there are a lot of ways to do everything. A trivial example: why can you bind variables in pattern matches with both case let .some(x) and case .some(let x)?
1 comments

Because the former works with all associated values in a case, whereas the latter does not. `case let .some(x, y, z)` vs `case .some(let x, let y, let z)`. And the latter exists because you may want some to be immutable and others to be mutable: `case .some(let x, var y, _)`.
In other words, the former is syntactic sugar and having just the latter option would suffice
Yes, but I also don't want to have to go around writing Optional<Array<String>> everywhere, so syntactic sugar is fine.