[swift-evolution] Dotless case names in switch cases

Jens Persson jens at bitcycle.com
Sat Jan 16 16:13:24 CST 2016


I wish I had written the title: "Remove dotless form of case names in
switch cases".
To clearify: I want the usual form with a dot to stay, and I think the more
unusual variant without the dot could be removed to solve the problem
demonstrated by Nate's example program and to simplify things (so that
there's just one way to write these things (always with a dot before the
case name)).
/Jens

On Sat, Jan 16, 2016 at 8:23 AM, Charles Constant <charles at charlesism.com>
wrote:

> -1
>
> I think this would make autocompletion in Xcode more complicated. I like
> seeing a list of all enum cases when I start typing
>
> On Fri, Jan 15, 2016 at 5:05 PM, Jens Persson via swift-evolution <
> swift-evolution at swift.org> wrote:
>
>> I see, I never thought of the case names as being instance-member-like,
>> and I thought it would be simpler to just  have one form for the switch
>> cases (the one with a dot before the case name).
>>
>> I don't want the dotless form to be removed if it complicates rather than
>> simplifies the (compiler) code.
>>
>> ( My mail was a reaction to this tweet / conversation:
>> https://twitter.com/UINT_MIN/status/688101066668281856 )
>>
>>
>> On Sat, Jan 16, 2016 at 1:42 AM, Joe Groff <jgroff at apple.com> wrote:
>>
>>>
>>> > On Jan 15, 2016, at 2:44 PM, Jens Persson via swift-evolution <
>>> swift-evolution at swift.org> wrote:
>>> >
>>> > enum SomeEnum {
>>> >     case Foo
>>> >     case Bar
>>> >     func demoDotAndNoDot() {
>>> >         switch self {
>>> >         case .Foo: print("This has the usual dot before the case
>>> name.")
>>> >         case Bar: print("This has no dot, which is ok, at least in
>>> this particular context.")
>>> >         }
>>> >     }
>>> > }
>>> >
>>> > I'm just throwing this out in case someone should feel like writing a
>>> formal proposal to remove the dotless form.
>>> >
>>> > I'd be ok with removing it since it only works in some specific
>>> contexts.
>>>
>>> This works by normal instance member lookup. Why do you think it should
>>> be removed?
>>>
>>> -Joe
>>>
>>>
>>
>>
>> --
>> bitCycle AB | Smedjegatan 12 | 742 32 Östhammar | Sweden
>> http://www.bitcycle.com/
>> Phone: +46-73-753 24 62
>> E-mail: jens at bitcycle.com
>>
>>
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>>
>>
>


-- 
bitCycle AB | Smedjegatan 12 | 742 32 Östhammar | Sweden
http://www.bitcycle.com/
Phone: +46-73-753 24 62
E-mail: jens at bitcycle.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160116/3708157e/attachment.html>


More information about the swift-evolution mailing list