On Tue, May 24, 2016 at 2:08 AM Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
> On Mon, May 23, 2016 at 7:57 PM, Michael Selik <michael.selik@gmail.com> wrote:
>
>>def demo(arg):
>>    if p, q ?= arg.x, arg.y:                        # dict structure
>>    elif x ?= arg.x and isinstance(x, int)          # assignment + guard
>>    elif a, b, *_ ?= arg:                           # tuple structure
>>    elif isinstance(arg, Mapping):                  # nothing new here

I'm unenthusiastic about this -- the above looks like
an unreadable mess to me.

Which is unreadable: ``if/elif`` keywords or ``?=`` operator? If it's the latter, please don't get hung up on that, as I intended that as a placeholder for whatever operator or keyword is best. My main point is that switch/case/matching is semantically identical to if/elif, so why use something different?
 
Some other worries:

* It appears that this would have to work by means of
exception-catching in the rhs, so it's really a
disguised form of the except: expression proposal;
is that intentional?

No. The exception-catching expression is not meant to be available in any other context. However, exception-catching is an essential feature to matching via destructuring. I believe it's unavoidable, though *which* exceptions are suppressed could be made more clear.

* It could also be abused to get an assigment-in-
expression anywhere you wanted. Such things have
been rejected before; are we changing our mind
on that?

No, using the assign-if-can operator would be syntax error outside of an if/elif, the reverse of how an assign operator is a syntax error inside an if/elif. 

* THere would be no hope of checking for coverage
of all cases in a static checker.

I believe you, though the logic isn't clear to me. Could you explain why?

 
I feel like we've wandered a long way from the idea
we started with, which is something to facilitate
a Haskell-like case-analysis style of programming,
and ended up with something much looser that tries
to be all things to everyone.

That was not my intention. If the assign-if-can operation is only available in an if/elif statement, I think it's exactly Haskell-like case-analysis and nothing more. Did I miss something?