> In the case where your input is hashable, you could just do:
>
> let i = [.Red:0xff0000, .Green:0x00ff00, .Blue:0x0000ff][color]

You forgot to declare the type, which is mandatory if you want to use
abbreviated cases like ".Red" to construct a one-off like that. That's one
of the reasons I complained that using a Dictionary is not a pleasant
alternative earlier on. The proposal ought to infer the enum Type, just
like a normal Switch statement.

On top of that, the limitations you mention also limit usefulness.

If it weren't for these issues, it would be good enough for me.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to