<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">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.<div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">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:</div><div class=""><br class=""></div><div class=""><ul class="MailOutline"><li class="">A <b class="">TupleType</b> 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:</li><li class="">An <b class="">ExpressableAsTuple</b>&nbsp;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.</li><li class="">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?</li></ul><div class=""><br class=""></div></div><div class="">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.</div><div class=""><br class=""></div><div class="">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!</div></body></html>