[swift-evolution] [Discussion] Naming directives
Jordan Rose
jordan_rose at apple.com
Thu Feb 25 13:48:05 CST 2016
I agree that camel-case is more readable than all-lowercase, although the only all-lowercase names currently are '#dsohandle' (very rarely used) and '#elseif' / '#endif'. I also have a knee-jerk reaction against '#endIf'; somehow '#EndIf' doesn't seem quite as bad to me.
I can see the argument for naming the expression-like directives like values. I'm not sure whether it's necessary that the non-expression-like directives follow the same naming convention. Something to explore.
Jordan
> On Feb 25, 2016, at 11:06, Антон Жилин via swift-evolution <swift-evolution at swift.org> wrote:
>
> 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.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
More information about the swift-evolution
mailing list