[swift-evolution] [swift-evolution-announce] [Review] SE-0098: Lowercase didSet and willSet for more consistent keyword casing

Kevin Ballard kevin at sb.org
Tue May 24 21:40:35 CDT 2016


On Tue, May 24, 2016, at 11:07 AM, Chris Lattner wrote:
> 	* What is your evaluation of the proposal?

-1. The only real rationale here is "other keywords that are compound words are all lowercase instead of camelCase" (except for dynamicType). But that's not a very compelling argument. More generally, I think `willSet` and `didSet` just looks better, and I think this may be because they are different types of phrases entirely than associatedtype, typealias, and fallthrough (they're certainly classified differently grammatically; willSet and didSet are verb pharses, associatedtype is an adjective phrase, typealias is a noun modifier [which is like an adjective phrase], and fallthrough is a compound word with precedent in other languages). They're also companions to the `set` declaration. Since `set` is a distinct concept in its own right, `willSet` and `didSet` highlight the fact that they're modifiers on the word `set`. In fact, if we had a distinct `type` declaration, then I think I'd want to change `associatedtype` into `associatedType`. The camel casing makes it more obvious that this is a variant on the root word, whereas all-lowercase implies that the entire conjoined phrase is a single standalone concept.

Also, as others have already pointed out, willSet and didSet will hopefully end up as property behaviors rather than language keywords, and in that case the stated rationale doesn't apply.

> 	* Is the problem being addressed significant enough to warrant a change to Swift?

No. The rationale for this can largely be summed up as aesthetic preference and it's pretty subjective.

> 	* Does this proposal fit well with the feel and direction of Swift?

Does bikeshedding syntax count as fitting with the feel and direction of Swift? ;)

> 	* If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

I'm having trouble thinking of a relevant language that uses phrases for keywords. I believe all of the keywords in Rust are single words. Haskell actually uses phrases rather than conjoined keywords, e.g. `data instance`, `type family`, etc. Obj-C/C generally uses snake_case.

> 	* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

A quick reading of the proposal and a reading of the review thread to date.

-Kevin Ballard


More information about the swift-evolution mailing list