[swift-evolution] Proposal: Allow #if to guard switch case clauses

rintaro ishizaki fs.output at gmail.com
Thu May 11 10:57:17 CDT 2017


Thank you all!


2017-05-11 16:18 GMT+09:00 John McCall via swift-evolution <
swift-evolution at swift.org>:

> On May 11, 2017, at 1:45 AM, Nicholas Maccharoli via swift-evolution <
> swift-evolution at swift.org> wrote:
> I also strongly agree.
>
> I can think of no strong argument against this, was this intentional at
> one point or a compiler bug?
>
>
> The language design of #if is more complex than it is in C: it is part of
> the language grammar, not a separate phase of pre-processing, and must be
> specifically supported in every position it appears.
>
> That said, I agree with Chris and Jordan that supporting #if in any
> simple, sequential position in the grammar is an obvious extension of the
> existing design and can reasonably be fast-tracked.
>
>
So, can I withdraw my proposal PR on swift-evolution repository now?


> Grammatically similar positions where it's hard to dispute the consistency
> argument for #if: get-set clauses, precedencegroup declarations.
>
> A position which would definitely be more useful to prioritize but where
> both the language design and the implementation are trickier: attribute
> lists.
>
>
John.
>
>
> - Nick
>
>
> On Thu, May 11, 2017 at 2:37 PM, Chris Lattner via swift-evolution <
> swift-evolution at swift.org> wrote:
>
>> I agree with Jordan.
>>
>> -Chris
>>
>> On May 10, 2017, at 11:47 AM, Jordan Rose via swift-evolution <
>> swift-evolution at swift.org> wrote:
>>
>> I'm in favor, certainly. I'd personally say this wouldn't even need to go
>> through the full evolution process, but I'm not a core team member.
>>
>> Jordan
>>
>>
>> On May 10, 2017, at 01:32, rintaro ishizaki via swift-evolution <
>> swift-evolution at swift.org> wrote:
>>
>> Hi evolution community,
>>
>> This proposal allows you to enclose switch cases with #if directive.
>> Implementation: https://github.com/apple/swift/pull/9457
>> This is one of the oldest SR issue:
>> https://bugs.swift.org/browse/SR-2
>> https://bugs.swift.org/browse/SR-4196
>>
>> Thanks!
>> Rintaro
>>
>>
>> _______________________________________________
>> 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
>>
>>
> _______________________________________________
> 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/20170512/1e126551/attachment.html>


More information about the swift-evolution mailing list