3.4 Binding and Annotation Macros
Macros can extend binding-position syntax, too, via bind.macro. In the simplest case, a binding operator is implemented by expanding to other binding operators, like this definition of $$$ as a prefix operator to constrain a pattern to number inputs:
More expressive binding operators can use a lower-level protocol where a binding is represented by transformers that generate checking and binding code. It gets complicated, and it’s tied up with the propagation of static information, so the details are in Binding Low-Level Protocol. After an expressive set of binding forms are implemented with the low-level interface, however, many others can be implemented though simple expansion.
The annot.macro form is similar to bind.macro, but for annotations.
annot.macro 'PosnList': 'List.of(Posn)'
ps[n].x
For details on the low-level annotation protocol, see Annotations and Static Information.