[swift-evolution] [Discussion] Naming directives

Антон Жилин antonyzhilin at gmail.com
Thu Feb 25 13:06:00 CST 2016


Currently, Swift follows all-lower convention for #-directives. We haven't
discussed it much, but just derived it from a few existing directives we
have.
Now people invent new directives: #setline, #fileliteral. Now it becomes
obvious that lowercase just breaks down for anything long enough. CamelCase
is much more clear (read distinguishable) than thatlowercasemess. Compare:

#colorliteral   vs   #colorLiteral
#imageliteral   vs   #imageLiteral
#setline   vs   #setLine

Directives read like functions:

#fileLiteral(resourceName: "name")
#setLine(1)
#available(iOS 8.0, *)

One may say that their arguments aren't really Swift values and objects,
but that's why they are directives, after all.

#if stands out a bit, but the change will not affect it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160225/aaf57055/attachment.html>


More information about the swift-evolution mailing list