[swift-evolution] Normalize Enum Case Representation (rev. 2)
Joe Groff
jgroff at apple.com
Thu Mar 9 15:55:09 CST 2017
> On Mar 9, 2017, at 5:59 AM, Matthew Johnson via swift-evolution <swift-evolution at swift.org> wrote:
>
> I have argued repeatedly that enum cases play two distinct roles (and sometimes a third in the future). We need to embrace all of these roles. This proposal primarily normalizes the role of case-as-factory-method.
>
> Pattern matching is a second role enum cases play. We already have syntax for patterns that match based on type. I see no reason we should introduce new matching syntax to disambiguate overloaded cases. The existing patterns work well for this purpose. Matching should be considered a role played by enum cases that is completely orthogonal to their role as a factory method.
Matching and construction are closely related and designed to mimic each other. They aren't completely orthogonal.
-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170309/6403f007/attachment.html>
More information about the swift-evolution
mailing list