[swift-evolution] Analysis of case conventions for initialisms
Dave Abrahams
dabrahams at apple.com
Fri Feb 12 10:56:10 CST 2016
on Fri Feb 12 2016, Jessy Catterwaul <swift-evolution at swift.org> wrote:
>> 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:
> uRL
>
>> No convention ever suggested “uRL”, and I can't imagine anyone writing that.
> It may be physically impossible to imagine so, at present.
> https://www.youtube.com/watch?v=_00qkCCuWc0&feature=youtu.be&t=1156
>
>> 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.
Oh! Sorry, I didn't realize you were actually suggesting that; I
thought you meant it as a misinterpretation of one of the conventions
listed.
As I mentioned to Marco, if you'd like to create an amended document
that accounts for that one, too, I'd be happy to incorporate it.
However, note that I've tried pretty hard to stay away from subjective
factors in the analysis; it would be good if you could do the same.
--
-Dave
More information about the swift-evolution
mailing list