Rules / Operators / circumfixes

[ ] Skeleton

circumfix [ ]

[ ]
circumfixterm 1/27non-assocRaku++ parses this — execution uncheckeddocs.raku.org ↗

The rules for [ ] have not been written yet. Everything below is extracted rather than authored: the official documentation supplies the classification, and the interpreters were asked directly about the rest.

What is established #

Classification #

[ ] is parsed as a circumfix at the term precedence level, non-associative.

That is level 1 of 27 on the ladder, counting from the tightest. Operators sharing a level bind equally; grouping among them is decided by associativity alone.

Shares its precedence level with #

< >, { }.

These all bind equally tightly, so an expression mixing them groups by associativity alone.

What the interpreter said #

Raku++ parses this spelling. Asked to compile:

sink([ 1 ])

…it got through the parser. On its own that establishes very little: it says nothing about whether the construct executes, let alone whether the result is right. Where the behaviour table below exists, that is the stronger evidence — those expressions were actually run.

Covered upstream #

The official documentation has a section for this construct: docs.raku.org. Until the rules here are written, that is the better reference.