In Operators§
See primary documentation in context for infix ~~.
The smartmatch operator calls the .ACCEPTS() method on its right-hand side, with its left-hand side as the argument. The semantics are left to the type of the right-hand side operand.
Here is a partial list of some of the built-in smartmatching functionality. For full details, see ACCEPTS documentation for the type on the right-hand side of the operator.
| Right-hand side | Comparison semantics |
|---|---|
| Mu:U | type check |
| Str | string equality |
| Numeric | numeric equality |
| Regex | regex match |
| Callable | Boolean result of invocation |
| Set/Bag | equal element values |
| Any:D | object identity |