[swift-evolution] [Proposal] More Powerful Constraints for Associated Types
David Sweeris
davesweeris at mac.com
Mon Apr 25 23:05:20 CDT 2016
Is that bad? We already have conditional inheritance in classes:
class Foo<T where _constraint_> : Bar<T> {}
If you move the where clause to the right:
class Foo<T> : Bar<T where _constraint_> {}
And drop the generic arguments:
class Foo : Bar where _constraint_ {}
The only difference is “protocol” vs “class”.
- Dave Sweeris
> On Apr 25, 2016, at 10:41 PM, Dmitri Gribenko via swift-evolution <swift-evolution at swift.org> wrote:
>
> On Mon, Apr 25, 2016 at 8:28 PM, Douglas Gregor via swift-evolution
> <swift-evolution at swift.org> wrote:
>> Did you consider an alternate syntax that puts the where clause outside the
>> braces, e.g.,
>>
>> protocol R : Q where AssocType : P {
>> // …
>> }
>
> To me this reads like declaring a conditional conformance.
>
> Dmitri
>
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
More information about the swift-evolution
mailing list