[swift-evolution] [Pitch] Allow use of the name "default" for enum cases and function names

E. Maloney emaloney at gilt.com
Fri Jun 17 17:12:08 CDT 2016


> On Jun 17, 2016, at 3:07 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> 
> Right. I don't think there's any plan currently to allow enum case declarations of reserved keywords without backticks. The reasoning, IIUC, was that use sites were far more common and in that context cases could be distinguished by the leading dot. By contrast, declarations are made only once.
> 
> FWIW, this is implemented for all keywords and not just `default`, so `.class` or even `.case` should work right now too. It seemed like the core team wanted general solutions that can be implemented for all keywords, and a general solution for declaring enum cases without backticks is probably not possible, I think?

I still don’t see why not. What could possibly come after the ‘case’ in an enum declaration other than the name of the enum case itself?

To my knowledge, the only modifier of an enum case is the “indirect” modifier, but that always comes *before* the “case” keyword, so there’s no ambiguity there.


More information about the swift-evolution mailing list