Pattern matching equal or same elements

I think it would be very cool and useful, and a further extension of the multiple case ideas (see for example QoL: Sound binding in pattern alternatives)

We could even allow patterns like the following:

x match
  case ExtractorA(y) & ExtractorB(y) => // branch if x matches both extractors, by analogy to
  case ExtractorA(y) | ExtractorB(y) => // branch if x matches either extractors

Alternatively, the symbol could be @, as this is a generalisation of it:

x match
  case  y@Extractor(z) => // is equivalent to
  case y & Extractor(z) =>
2 Likes