|
The match-bind expression performs a pattern match, and tests whether it succeeds. It evaluates the left hand expression to a value -- the specimen. It then matches the specimen against the pattern. The match-bind expression as a whole evaluates to a boolean indicating whether the match succeeded. In either case, the variable bound by pattern are available in the succeeding scope. If the match succeeded, then these variables will bound to the values they extracted from the specimen. If the match fails, then, in the succeeding scope, all these variables will be bound to broken references (XXX need to specify the problem). If a variable was part of an earlier sub-pattern than succeeded before the match as a whole failed, then this variable will be seen to bound to the value it extracted from the specimen by later code within the overall pattern, but will be seen to by bound to the broken reference by code after the match-bind expression as a whole. This "change" in binding happens even if the variable is declared ":final". Effectively, the variables defined within the pattern are redefined following the pattern and initialized accordingly. |
|
||||||||||||||||||||||||||
| Unless stated otherwise, all text on this page which is either unattributed or by Mark S. Miller is hereby placed in the public domain.
|
|||||||||||||||||||||||||||