[swift-evolution] [Idea] Allowing most keywords after "."
Ross O'Brien
narrativium+swift at gmail.com
Sat Feb 27 08:31:36 CST 2016
It seems to me that deprecating 'default' should be its own topic, or the
discussion on it will be harder to find, so I'd suggest making a topic
dedicated to that idea, and keeping this one focused on .`keyword`.
Look for the topic: "[Idea] Deprecate the 'default' keyword."
On Sat, Feb 27, 2016 at 2:18 PM, David Waite via swift-evolution <
swift-evolution at swift.org> wrote:
> Keywords following dots not requiring backticks also seems a valid option.
>
> More of a meta-comment:
> 1. Default was actually a poor name choice for an enumeration case given
> the meaning of ‘default’ in the language. Some might say this name choice
> is now being escalated
> 2. Default has always been a restrictive term to have as a keyword,
> although it is only really required to be considered a keyword in one place
>
> I personally would be fine with switching ‘default’ for ‘else’, as another
> evolutionator suggested. I don’t remember if this was proposed previously,
> or if that was only the idea of ‘case _:’, which I’m not really in favor of.
>
> -DW
>
> On Feb 26, 2016, at 1:43 PM, Douglas Gregor via swift-evolution <
> swift-evolution at swift.org> wrote:
>
> Hi all,
>
> As part of the grand API guidelines discussion, there was a lot of support
> for using lowerCamelCase for enum cases, because they are values in Swift.
> One unfortunate wrinkle here is that it’s not at all uncommon to have a
> case named “Default” for an enumeration. One example pulled randomly from
> GitHub:
>
> enum DispatchQOS {
> case UserInteractive
> case UserInitiated
> case Default
> case Utility
> case Background
> }
>
>
> If we’re lowerCamelCasting enum cases, this becomes:
>
> enum DispatchQOS {
> case userInteractive
> case userInitiated
> case `default`
> case utility
> case background
> }
>
> Note the back-ticks, which are also needed at the call site:
>
> func dispatch(priority priority:
>
> dispatch(priority: .`default`) { … }
>
> We could allow one to refer to keywords without back-ticks following a
> “.”, similarly to the way we allow keywords without back-ticks preceding a
> ‘:’ for argument labels, e.g.:
>
> func dispatch(priority priority:
>
> dispatch(priority: .`default`) { … }
>
> One would still need to use back-ticks in the declaration of the case, but
> at least uses would be back-tick-free. Thoughts?
>
> - Doug
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160227/3b5c4104/attachment.html>
More information about the swift-evolution
mailing list