2017-01-17 22:26 GMT+03:00 Joe Groff <[email protected]>:

> enum Something : RawRepresentable<Int32>
> +1. But we don’t have generic protocols right now :(
>
> I think this would be the right direction to go if we wanted to de-magic
> the existing RawRepresentable behavior. At this point, It would be
> reasonable to support this via where clauses on associated types:
>
> enum Something: RawRepresentable where RawValue == Int32 { ... }
>
>
We don't have this conformance syntax either. As the enum is not generic,
the above should be read as:

    enum Something: (RawRepresentable where RawValue == Int32) { ... }

And this requires generalized existentials again.

though that's pretty verbose. In the fullness of time, a generic typealias
> to a generalized existential could help with that, though:
>
> typealias RawRepresentableOf<T> = RawRepresentable where RawValue == T
>
>
> At that point, the compiler-built becomes closer to just a "regular"
> default implementation. There's still the privileged sugar for matching
> cases to raw values.
>
> -Joe
>
>
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to