[swift-evolution] [Pitch] Introducing `Unwrappable` protocol
glessard at tffenterprises.com
Tue Mar 7 16:44:00 CST 2017
I like some of this, but as a single proposal, it does too many things at once.
- The `case let .some(foo)` vs. `case .some(let foo)` issue could be a targeted proposal.
(I really like this)
- The Unwrappable protocol (and keyword) is interesting; it can probably be its own discussion.
(feels unnecessary, without feeling wrong)
- I’m not clear about the proposed solution about shadowing. Is it’s simply the `let` restriction or is there more to it? In any case I don’t think the compiler should disallow shadowing, even if there is a new warning; if there is a new warning there must be a way to spell a shadowed name so as to silence the warning.
- The whole pattern-binding in if/guard/for statements is certainly ripe for improvement; I agree with Anton Zhilin’s comment that pattern-before-expression is confusing. The switch statement puts the expression before the patterns, and it reads well. More than once, after having written an `if case` statement, I later changed it to a `switch` statement in order to improve readability.
More information about the swift-evolution