[swift-evolution] [Discussion] Naming directives

Howard Lovatt howard.lovatt at gmail.com
Thu Feb 25 14:03:21 CST 2016


Camel-case, mild preference for lower since keywords are lower

On Friday, 26 February 2016, Jordan Rose via swift-evolution <
swift-evolution at swift.org> wrote:

> 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 <javascript:;>> 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 <javascript:;>
> > https://lists.swift.org/mailman/listinfo/swift-evolution
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <javascript:;>
> https://lists.swift.org/mailman/listinfo/swift-evolution
>


-- 
-- Howard.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160226/5d92c9e4/attachment.html>


More information about the swift-evolution mailing list