[swift-dev] How is `static` a contextual keyword?

Jose Cheyo Jimenez cheyo at masters3d.com
Thu May 11 17:48:34 CDT 2017

Hello Swift Dev, 

`class` is a contextual keyword because it can be used to declare an object and declare a class variable. Right?

I believe static can only be used inside Classes, Structs, Enums, Protocols and Extensions so how is `static` a _contextual_ keyword?

Is there a reason why static is a keyword and not a “buildIn” modifier like final, public etc? 

Or is it just for historic reasons?

“The "type" keyword was split into two: "static" and "class".  One can define static functions and static properties in structs and enums like this:…."

https://github.com/apple/swift/commit/571c9b3c5ef995e280b494c751804b385b49e7b9 <https://github.com/apple/swift/commit/571c9b3c5ef995e280b494c751804b385b49e7b9>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170511/f3025b10/attachment.html>

More information about the swift-dev mailing list