[swift-evolution] Analysis of case conventions for initialisms

Jessy Catterwaul mr.jessy at gmail.com
Fri Feb 12 08:12:11 CST 2016

> I take it you'd be in favor of option 2 on that page, then?
No. I am in favor of the convention I typed:

>  No convention ever suggested “uRL”, and I can't imagine anyone writing that.  
It may be physically impossible to imagine so, at present.

> Can you?
Yes. The two I use most in code are (the members are real but the types aren't): 

let uRL: URL
let jSON: JSON

URL is an initialism.
JSON is a hybrid initialis-acrony-m.
What’s important is not that something is an initialism, but:
1. How it is spelled outside of code
2. Whether it is an instance, a type, a protocol that defines one member, or a protocol that defines multiple.

We encode the information of whether something is an instance, or a type, with casing. That’s ridiculous, but at least it’s easy, if your types start with English letters. To minimize cognitive load:

1. Make the first letter lowercase regardless of whether you abbreviate to initialisms.
2. Don’t start types with lowercase letters. Of Course IThings’ names get ruined. If that’s considered a problem, then we should stop using casing for type/instance, and impart better information via the IDE.

More information about the swift-evolution mailing list