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

Matthew Johnson matthew at anandabits.com
Mon Dec 7 13:34:22 CST 2015

> One important difference between “static” and “class” on a class is the behavior of storage.  In principle, a static variable in a class is just a rescoped global (although it is unclear how this is affected by generics).  A class variable in a class is conceptually a member of the class, and subclasses should get a separate copy.

I understand that this is the case in general, but is it still the case when a class variable is marked as final in its initial declaration?

If class variables do behave differently even when declared final I wonder whether the use cases for this behavior are compelling enough to justify the conceptual complexity of two different keywords.  I would be very interested in seeing examples of using a final class variable where separate storage for each subclass is desirable and useful.  

More information about the swift-evolution mailing list