<div dir="ltr">+1 for #2, which is also what Java and Google code conventions do. It looks awkward at first, but being able to distinguish word boundaries is surprisingly important. Tech is rife with initialisms; you could realistically have a class or constant like AWSS3RPCURL where every single letter is part of an initialism.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 11, 2016 at 10:52 PM, Brent Royal-Gordon via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> I just posted a write-up about various case conventions for initialisms:<br>
> <a href="https://gist.github.com/dabrahams/55fc5ece355da4664730" rel="noreferrer" target="_blank">https://gist.github.com/dabrahams/55fc5ece355da4664730</a>. I was surprised<br>
> at how it turned out, FWIW.<br>
<br>
</span>This is perhaps not a practical answer, but honestly, I'm having trouble thinking of a case where a variable name that's an initialism is a *good* name. Initialisms often make sense as types—HTML, URL, UUID, etc. But as variable names, they tend to be overly vague. For instance, in the example you give:<br>
<br>
func saveToURL(<br>
_ url: NSURL,<br>
forSaveOperation saveOperation: UIDocumentSaveOperation,<br>
completionHandler completionHandler: ((Bool) -> Void)?)<br>
<br>
`url` is not really a very descriptive name for the parameter; it would probably be better as `destinationURL` or `fileURL` or `documentURL`. You might even want to drop the `URL` from the end of those, making `destination`, `file`, or `document`. The name `url` is about as descriptive as `block` would be for the last parameter.<br>
<br>
(That's not to say I haven't done this; I certainly have. But I'm thinking that maybe the code where I did it wasn't as good as it could have been.)<br>
<br>
So I wonder if we shouldn't instead guide that initialisms should not appear at the beginning of variable names. You should name your variables (and properties) for their semantic, not their type.<br>
<br>
If initialisms don't appear at the beginning of variable names, then you can distinguish between types and variables by capitalization. That leaves only the word boundary issues, which I think we can live with.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Brent Royal-Gordon<br>
Architechies<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</div></div></blockquote></div><br></div>