internal protocol FactoryInitializable { init(factory: () -> Self) } extension FactoryInitializable { init(factory: () -> Self) { self = factory() } } public protocol DisposerProtocol { func dispose() } public class Disposer : DisposerProtocol, FactoryInitializable { internal init(void: Void) {} public convenience init<X: DisposerProtocol>(_ base: X) { self.init(factory: { Disposer.init(void: ()) }) } public func dispose() {} } public class EventEmitter<Event> { private class Unsubscriber : Disposer { public override func dispose() {} } }