[swift-evolution] Unify `static` and `class` keywords

Jordan Rose jordan_rose at apple.com
Tue Dec 8 17:40:49 CST 2015


> On Dec 7, 2015, at 19:12, Ling Wang via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Besides, we shouldn’t use `final` to denote storage at all for `final` is about inheritability/overridability not about storage.
> 

Please remember that stored properties can be overridden in Swift:

class Base {
  /*instance*/ var flag: Bool = true
}

class Sub : Base {
  override var flag: Bool {
    didSet {
      if flag { print("The flag was set!") }
    }
  }
}

This is theoretically possible at the class level as well, but doesn't really make sense for what's currently spelled "static var", since you'd be accessing the same storage in different ways. Does the proposal mean that a stored "type var" is non-overrideable, but a computed "type var" is overrideable, implicitly?

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151208/9e25d5ff/attachment.html>


More information about the swift-evolution mailing list