Following on from discussion about stored properties for enums, I've decided to split off discussion about the possibility of enabling tuples as raw values.
Currently to enable multi-part raw values we need to define a struct that conforms to RawRepresentable; this involves a lot of boilerplate however, and seems like exactly the kind of thing that tuples are ideally suited towards simplifying.
To make tuples automatically conform to RawRepresentable will likely require some compiler magic, but I think it's worth doing, and should be doable with the following additions:
A TupleType protocol (uncertain of correct name for it) to which all specific tuple types will automatically conform, and to which user-defined types may not. This is simply a marker type for now (no methods etc.), as it is essentially just to enable the following:
An ExpressableAsTuple protocol, following the same style as other ExpressableAs* protocols, with the associated type conforming to TupleType, thus requiring that it be a specific tuple definition. All specific tuple types are automatically expressible as themselves.
All tuples will then conform to RawRepresentable, simply returning themselves as their raw value. This may require some magic as well, since I don't know if we want tuples to gain a .rawValue property or not, so could be exposed only when handling them as RawRepresentable specifically?
With ExpressableAsTuple recognised as RawRepresentable, I believe this should satisfy all requirements such that enums, and other types requiring literals, will be able to accept tuples in addition to the types that they currently do.
I think I've covered the requirements here, and I'm hoping someone can confirm if this looks correct. Of course I'm open to any other suggestions on how we might enable tuples as literals, especially if there's an easier way!