I apologize for any possible flood (if there is any restriction in this mail 
list).

One other example that comes to mind, where I can’t really tell if this would 
be possible to express with `struct<>`, can be defined outside of the generic 
scope just like `class<SomeBaseClass, SomeProtocol>` or `all<SomeBaseClass, 
SomeProtocol>`:

var structArray: [struct<Any, SomeProtocol>]

Would this work? This is an interesting case, where no values inside the struct 
can be reference-types!
Actually I can answer this question by myself, because `Any` is just a 
typealias for `protocol<>` and does not violate any rule here.

This also adds a few more type combinations I missed out in my proposal:

e.g. `struct<Any>` is equivalent to `struct<protocol<>>`

This can allow us to use any struct without the need of generic scope! Isn’t it 
great or what?

Have you ever wanted to store any class references with conformance to a 
protocol without the generic system, with this you could do so `class<Any, 
SomeProtocol>`: 

var classArray: [class<Any, SomeProtocol>]



Best Regards,

Adrian Zubarev



_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to