8.15.0.4

5.2 Rules for Static Information🔗ℹ

Exactly how static information is associated to expressions and bindings depends on the expression or binding form. So, it’s not possible to write down exhaustive rules for for Rhombus static information (in the same way that it’s not possible to write down a full grammar, since the grammar can be extended via macros). A binding or expression form’s documentation should define what static information it associates with a name or expression.

Here’s a summary of the static-information behavior of classes:

More rules about static information in general:

The List, Array, and Map expression and binding forms are analogous to class-name forms. For example, Array as a constructor in an expression form associates reference-result information to the overall Array expression, as does [] for constructing a list. In a list binding pattern, when ... is used after a binding subpattern, the “upward” static information of the subpattern for each identifier wrapped as reference-result information for the identifier outside the list pattern, since each; for example [p :: Posn, ...] as a binding pattern causes p to have static information that says its reference result as Posn-annotation information. The List.of, Array.of, and Map.of annotation forms in bindings propagate “downward” reference-result information to nested annotations. “Downward” static information is used by List or [] pattern constructions only in the case that there’s a single element binding pattern followed by ..., while Array and Map as pattern constructors cannot use “downward” information.

The :: binding form and the matching annotation form allow static information to flow both “downward” and “upward” through both annotations and binding patterns.