[swift-evolution] Anoymous Enums (Updated)

Erica Sadun erica at ericasadun.com
Mon Feb 22 10:46:17 CST 2016


> On Feb 22, 2016, at 3:53 AM, Tino Heth via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I'm not sure wether I want to see that feature added, but I think there is a "structural" argument for it:
> We have anonymous functions (closures) and a (restricted) form of anonymous structs (tuples), so it would be consequent to have a anonymous variant for each fundamental entity in the language.
> I guess it is to late to establish a unified syntax for all of those, though…

I like the symmetry with the other anonymous types. This provides a highly focused tweak to Swift, with limited impact, and a measurable benefit to developers. (AKA the "Rule of Lattner")

Further, the values cannot be assigned to variables or passed as arguments as they have no "type".  I suspect it won't be hard to restrict them for being used with `Any` argument, limiting their use to flags and switch cases. If I'm conceptualizing this correctly, the benefits are clear and the consequences are small.

-- Erica

> On Feb 21, 2016, at 11:52 PM, Yong hee Lee via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
> please check the link below.
> 
> https://gist.github.com/erica/9148e2be916c7fae6f1e <https://gist.github.com/erica/9148e2be916c7fae6f1e>
> 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160222/4e59a30c/attachment.html>


More information about the swift-evolution mailing list