Basically I want to be able to mix in live or historical processing into my algorithm. The following does not compile.
// Event driven processing
class Event {
}
// Live events (as opposed to historical)
trait Live extends Event {
}
class Algorithm {
}
new Algorithm with Live
By declaring
trait Live extends Event, you specify thatLivecan only be applied to subclasses ofEvent. Later, you’re trying to apply it toAlgorithm, which is not a subclass ofEvent, hence the compiler complains.Depending on your original intent (not clear from that snippet), you may want to either:
Eventas a trait itself;AlgorithmextendEvent.