The answer here is the same as the answer you've gotten from those other excellent resources.
Here's the issue: Imagine that Swift supported this feature. You write this line of code:
let event0 = events[0]
let event1 = events[1]
event0.doSomething(event1.interval)
Is this code valid? Well, who knows? `event0` and `event1` might have different Interval types, or might not.
Java's type system does not try to protect you from this kind of mistake; Swift's does. Unfortunately, it's not yet expressive enough to describe the types involved. Consider this snippet:
let event = events[0]
let interval = event.interval
What's the type of `interval`? There's no way you can know for sure, really. All you can really say is "whatever the `IntervalType` of `event` is".
There are proposals in the works to actually allow you to say `event.IntervalType` as a type, but unfortunately they won't make Swift 3. Until that feature is added, you have three options:
1. Fake that intended future Swift feature by writing `AnyInterval` and `AnyEvent` type-erasing wrappers.
2. Halfway fake it by writing an `AnyEvent<IntervalType>` type-erasing wrapper.
3. Remove the associated type and require that any `Event` work with any `Interval` (or make `Interval` a concrete type).
···
On Jul 13, 2016, at 11:23 AM, 4 bottiglie g via swift-dev <swift-dev@swift.org> wrote:
When I read it before, I seem to remember it explicitly called out having an Array of Equatable as an example of something which should be allowed. I can’t see it there now, but I think it’s still the intention that it works some day.
Karl
···
On 13 Jul 2016, at 20:23, 4 bottiglie g via swift-dev <swift-dev@swift.org> wrote: