<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 23, 2016, at 11:01 AM, David Owens II <<a href="mailto:david@owensd.io" class="">david@owensd.io</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">What about enums with associated data? Those really are like types. So do we capitalize those?<br class=""></div></div></blockquote><blockquote type="cite" class=""><div class=""><div class=""><br class="">Unless those get redesigned, there is really this contrary feel to those and other enum cases. <br class=""></div></div></blockquote></div><br class=""><div class="">Before open sourcing, I had written up some thoughts on this:</div><div class=""><br class=""></div><div class=""><a href="https://github.com/apple/swift/blob/master/docs/proposals/EnumStyle.rst" class="">https://github.com/apple/swift/blob/master/docs/proposals/EnumStyle.rst</a></div><div class=""><br class=""></div><div class="">From an API perspective, an enum 'case' behaves similarly to a factory method or initializer on a struct or class, and in native Swift we generally prefer `init`s to static factory methods when possible. We also see a lot of API design in the wild where framework authors paper over the enum-ness of their API enums with initializers:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">enum Result<T> {</div><div class=""> case Success(T)</div><div class=""> case Error(ErrorType)</div><div class=""><br class=""></div><div class=""> init(success: T) { self = .Success(success) }</div><div class=""> init(error: ErrorType) { self = .Error(error) }</div><div class="">}</div><div class=""><br class=""></div></blockquote>We hadn't settled on our argument label model when we originally designed and implemented enums; I feel like if we had, it's likely we would have favored cases that natively look and feel more like initializers, using labels to distinguish cases:<br class=""><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><br class=""></div><div class="">enum Result<T> {</div><div class=""> case (success: T)</div><div class=""> case (error: ErrorType)</div><div class="">}</div></blockquote><div class=""><br class=""></div><div class="">-Joe</div></body></html>