Sub typing is the answer that we're going with then? On Sat, Jun 4, 2016 at 4:26 PM, T.J. Usiyan <[email protected]> wrote:
> It could be a more general solution. I am unclear about what 'subtype > relationships' means here though. > > Are you talking a about what you allude to here? > https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151130/000525.html > > > The benefit of explicitly narrowing, in my opinion, is that there is no > unnecessary cost to figuring out lookup. (Please correct me if I am > mistaken.) Implicit promotions introduce uncertainty with regard to what a > value is being treated as in any given moment. This uncertainty is worth it > in many cases but I will suggest that it is not worth it when trying to > deal with a narrower set of cases from an already established set. For > example, in the graph/lattice situation, conversions must be written > because there is no reasonable conversion that can be assumed. In this > proposal, the conversion is obvious and trivial because the relationship is > completely clear. > > All of that said, I *am* unclear about what subtype relationships means so > it may very well be a better solution. It certainly sounds like a more > general solution but I am not convinced that that is an advantage when > trying to deal with a strict subset. > > TJ > On Sat, Jun 4, 2016 at 1:25 AM, Chris Lattner <[email protected]> wrote: > >> >> On Jun 3, 2016, at 2:35 PM, T.J. Usiyan via swift-evolution < >> [email protected]> wrote: >> >> Since this seems to have some interest, I've made a gist. >> >> https://gist.github.com/griotspeak/963bc87a0c244c120264b11fb022d78c >> >> >> We have frequently discussed introducing subtype relationships between >> structs and enums, in an effort to allow limited implicit promotions (e.g. >> from small integers to wider integers). Wouldn’t that be a more general >> solution to this same problem? >> >> -Chris >> >> >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
