| 1 | (* match on an exported variable: its names stand for the fields of a |
| 2 | copy, which the arm may change without changing the variable. *) |
| 3 | module ExportedMatch; |
| 4 | import Out, Shared; |
| 5 | |
| 6 | proc show; |
| 7 | begin |
| 8 | match Shared.shape of |
| 9 | | dot: Out.str("dot"); |
| 10 | | circle(r): r := r + 1; Out.int(r); |
| 11 | end; |
| 12 | Out.ln; |
| 13 | end; |
| 14 | |
| 15 | proc main*; |
| 16 | begin |
| 17 | show; |
| 18 | show; |
| 19 | end; |
| 20 | |
| 21 | end ExportedMatch. |