Fwd: Pattern Matching Syntax

2018-05-11 22:01 GMT-04:00 Robert Roskam <raiderrobert@gmail.com>:

I find it weird for case statements to be "inside" match statements. There's isn't a statement "group" that works this way right now, AFAIK. This would also be weird: match X: case Y: ... I thought a form based on try would make more coherent: match: suite case x: suite1 else: suite2 suite would be executed, and the last expression would be checked against each case. If no matching case is found, suite2 would be executed. Does it make sense? On Sat, May 12, 2018 at 8:51 AM, Steven Heidel <steven@rigetti.com> wrote:

In some sense async and await are like this group you describe, the keyword "await" doesn't have meaning outside a function annotated with "async". The issue I'd have with your proposal is that it requires the "suite" to be an expression-based multi-line statement, ie. where the last statement becomes the value that is matched against. Similar to the original proposal that started this thread: these sorts of expression-based constructs don't feel that natural for Python. On Saturday, May 12, 2018 at 2:50:49 PM UTC, Andrés Delfino wrote:

I find it weird for case statements to be "inside" match statements. There's isn't a statement "group" that works this way right now, AFAIK. This would also be weird: match X: case Y: ... I thought a form based on try would make more coherent: match: suite case x: suite1 else: suite2 suite would be executed, and the last expression would be checked against each case. If no matching case is found, suite2 would be executed. Does it make sense? On Sat, May 12, 2018 at 8:51 AM, Steven Heidel <steven@rigetti.com> wrote:

In some sense async and await are like this group you describe, the keyword "await" doesn't have meaning outside a function annotated with "async". The issue I'd have with your proposal is that it requires the "suite" to be an expression-based multi-line statement, ie. where the last statement becomes the value that is matched against. Similar to the original proposal that started this thread: these sorts of expression-based constructs don't feel that natural for Python. On Saturday, May 12, 2018 at 2:50:49 PM UTC, Andrés Delfino wrote:
participants (4)
-
Andrés Delfino
-
Jelle Zijlstra
-
Steven Heidel
-
steven@rigetti.com