[Discussion] Allowing subclasses to override requirements satisfied by defaults

Do we still get this in Swift 3?

protocol P {}

extension P {
  func foo() { print("P") }
}

class C : P {
  // gets the protocol extension's
}

class D : C {
  /*override not allowed!*/ func foo() { print("D") }
}

let p: P = D()
p.foo() // gotcha: prints "P" rather than "D"!

What will happen if I declare a final computed property or function inside the default implementation?

protocol P {}

extension P {
  final func foo() { print("P") }
}

class C : P {
  // gets the protocol extension's
}

class D : C {
  /* can not override because of final */ override func foo() { print("D") }
}

let p: P = D()
p.foo() // prints "P"

···

--
Adrian Zubarev
Sent with Airmail