Generalize "x is y z" support #8328
-
Given that the new proposal for union types extends "x is y" even further, would it be possible to get a generalized way to implement the "x is y z" pattern in our own types? It seems the proposal for union types would lower to specific code that is only supported by union types, I think it should be considered if the proposal could be split into two, where the union type proposal would be based on and require the other one, which would propose this generalized support for "x is y z" patterns. For instance:
and then:
Obviously this would be ripe for abusing, but I think it might make patterns even more useful when used a bit more cautiously. Musings:
(note, I did do a search for similar discussions, but the word "is" seems to be a popular word, apologies if there is a similar post here) |
Beta Was this translation helpful? Give feedback.
#1047