What about declaring the requirements for auto-conformance in a sub-protocol?
@auto protocol AutoEquatable : Equatable {
//"syntax" for how to conform to Equatable
}
struct Foo : AutoEquatable {} //the compiler automatically synthesizes
everything
struct Bar : Equatable {} //you manually conform
It would be a compiler error to conform to an `@auto` protocol if the compiler
couldn't apply the provided "syntax" to the conforming type.
(I have no clue what this "syntax" could be, other than some expansion of
generics and/or a macro system)
Anyway, does that help? It satisfies both the "explicit conformance" crowd and
the "no new keywords" (at least at the "call" site) crowd.
- Dave Sweeris
> On May 30, 2016, at 15:26, Vladimir.S via swift-evolution
> <[email protected]> wrote:
>
> I see these two groups: both wants explicit conformance to protocols, but
> first thinks that current syntax is enough (`: Equatable`) and second thinks
> we should introduce new keyword `deriving` for this(`: deriving Equatable`).
> I see no opinions(except the one opinion in proposal itself) to automatically
> deriving without explicit decoration.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution