Skip to content

Instantly share code, notes, and snippets.

@erica
Last active May 20, 2016 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erica/7fa61c3b74b2a2635dbea02120ac5407 to your computer and use it in GitHub Desktop.
Save erica/7fa61c3b74b2a2635dbea02120ac5407 to your computer and use it in GitHub Desktop.

Adopting consistent keyword casing in Swift

  • Proposal: TBD
  • Author: Erica Sadun
  • Status: TBD
  • Review manager: TBD

Introduction

This proposal adopts consistent conjoined keyword lowercasing.

Swift-evolution thread: RFC: didset and willset

Motivation

Swift is an opinionated language. One opinion it adheres to is that keywords should use conjoined lowercasing. Conjoined lowercase terms already in the language include typealias, associatedtype, and fallthrough. Using this casing style enables programmers to treat keywords as atomic concepts. This proposal formalizes this rule and fixes current inconsistencies.

Detailed Design

Upon adoption, Swift will rename didSet and willSet to didset and willset. Future expansions to the language will follow this adopted rule, for example didchange.

This proposal deliberately omits the dynamicType keyword, which will be addressed under separate cover: to be moved to the standard library as a standalone global function.

Impact on Existing Code

This proposal requires migration support to rename keywords that use the old convention to adopt the new convention. This is a simple substitution that should limit effect on code.

Alternatives Considered

Not adopting this rule for Swift.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment