[swift-evolution] Anonymous Enums

Yong hee Lee yonghee226 at gmail.com
Fri Feb 19 10:46:37 CST 2016


Hi, I have a proposal.


enum Foo {
  case foo,bar
}

func test(a:Foo) {
  // …
}

test(.bar)


If I use an enum only as a parameter of a function, the name of enum  is redundant. 

so I suggest a compact version like below.



func test(a:[foo|bar]) {
  // ...
}

test(.bar)



func adjustTemperature(temp:[low|normal|high]) {
  // ...
}

adjustTemperature(.high)



I think this is very useful.
What do you think?

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


More information about the swift-evolution mailing list