Just thinking out load. This could still be allowed in the future right?
Some bikeshedding:
enum E {
case foo(@W label: Int)
// compiler generates some static initializer
// .foo(label:)
// .foo($label:)
// baking storage of the associated value remains W
}
let e = E.foo(label: 42)
// sugar for
let e = E.foo(_label: W(wrappedValue: 42))
switch e {
// only one of these can be used, not both at the same time
case foo(label: var intValue):
...
case foo($label: var projectedValue):
...
}
// this is basically sugar over
// case foo(_label: let wrapper):
// var intValue = wrapper.wrappedValue
// var projectedValue = wrapper.projectedValue
The baking storage remains private, like in the current proposal. The value will be wrapped and have some effects applied to it. I can only see benefits in terms of usage and consistency.
Thoughts?