Avatar
omochimetaru 12/8/2017 8:40 AM
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() {} } }
8:40 AM
$ swift -O だとコンパイラが戻ってこないコード
8:41 AM
CPU使用率が99%に張り付く。