In Match§
See primary documentation in context for routine make
method make(Match:D: Mu $payload) sub make(Mu $payload)
Sets the .ast
attribute, which will be retrieved using .made
.
$/.make("your payload here");
That is, it stores an arbitrary payload into the Match
object that can later be retrieved via .made
method. Since the sub form operates, by default, on $/
, that example is equivalent to:
make("your payload here");
This is typically used in a grammar's actions class methods, where a piece of data is stored by one method and then later retrieved by another. It's up to you what data you store. It could be a tree node, result of a calculation, a type object, or a list of values.
The sub form operates on the current Match $/
, which can be a convenient shortcut:
method my-action ($/) { make "foo: $/"; }