On Apr 25, 2016, at 11:18 AM, Michael Peternell via swift-evolution <[email protected]> wrote: > > Is "Self" dynamically dispatched? What would the following program print? > > class A: NSObject { > static func myClassName() -> String { > return "A" > } > func hello() -> String { > return "I am a \(Self.myClassName())" > } > } > > class B: A { > static func myClassName() -> String { > return "B" > } > } > > print(B.init().hello()) > > Because I think "Self" would only cause confusion if it is statically > dispatched. assert(B.init().hello() == "I am a B") > > -Michael
The current Swift will not allow your second example to compile. -- E
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
