[swift-evolution] Pre-proposal: CaseEnumerable protocol (derived collection of enum cases)

Jacob Bandes-Storch jtbandes at gmail.com
Tue Jan 19 13:49:49 CST 2016


I think it would make sense for the syntax to be explicit that something is
being derived by the compiler. Haskell uses "deriving"
<http://book.realworldhaskell.org/read/using-typeclasses.html#typeclasses.auto.derivation>
for this. I'm not sure what it should look like in Swift (suggestions
welcome), and I'm also not sure if it's worth figuring that out for the
first version of this feature, or whether we'd be better off making that
change later.

Jacob

On Tue, Jan 19, 2016 at 11:37 AM, David Waite <david at alkaline-solutions.com>
wrote:

> ErrorType’s magic is only for Objective-C interoperability, and only
> exposed by diving into compiler implementation-level protocols.
>
> This seems like a case where some syntax consistency is needed between
> ‘code generation’ proposals (such as member wise initializers). If there
> was guidance on what an eventual macro system syntax could look like, this
> could be taken into account as well.
>
> -DW
>
> On Jan 19, 2016, at 11:36 AM, Jacob Bandes-Storch via swift-evolution <
> swift-evolution at swift.org> wrote:
>
> Yes: ErrorType.
>
> On Tue, Jan 19, 2016 at 10:21 AM, Sune Foldager <cyano at me.com> wrote:
>>
>>>
>>> Hm, I don’t think I like that. Are there other examples of magic
>>> protocols in Swift?
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160119/b6d7e349/attachment.html>


More information about the swift-evolution mailing list