On Sat., 7 Nov. 2020, 9:56 am Greg Ewing, <greg.ewing@canterbury.ac.nz> wrote:
On 7/11/20 4:03 am, Thomas Wouters wrote:

> It's also why I'm not in favour of PEP 642 and other proposals for
> solving some of the problems in the Structural Pattern Matching proposal
> (sigils, etc): it widens the gap instead of closing it.

Does that mean you're against *any* proposal that involves sigils, or
just PEP 642 in particular?

Also, I'm very confused about why you're against PEP 642. It seems to
do a good job of meeting your stated goals -- syntax in common between
unpacking and matching has the same meaning, and the way is left open
for making them more like each other in the future. Can you elaborate
on what you don't like about it?

It seems worth noting that many of Thomas's reservations align with my own about my proposal in PEP 642 (both the original version I published last week and the updated one I just published today).

Certainly my *goal* is to address those key concerns (since I share them), but it's an open question whether or not I've actually achieved that (especially now I've conceded the point that keeping match patterns readable is going to require *some* flavour of syntactic shorthand that will never work in regular assignment targets - while PEP 642 proposes defining that in terms of a more explicit syntax that *could* be added to assignment targets, the shorthand forms would still be forever inconsistent).

Cheers,
Nick.

P.S. FWIW, I'll also note that do have a strong pro-"|" opinion on MatchOr patterns (I think trying to read "or" in that position would degenerate into keyword soup, whereas the vertical bar stands out nicely), and have been burned by enough restrictive JSON parsers that collapse when the sender adds a new key to an object to be strongly pro "ignore extra mapping keys by default" in mapping patterns. However, I don't think those kinds of questions are anywhere near as fundamental as the one about whether or not potential syntactic consistency with assignment targets should even be a design goal in the first place.