PSArm
PSArm copied to clipboard
Reconcile variable definition and emission of values
Currently PSArm makes it simple to define, for example, a resource:
Resource ... {
}
By just defining it inline in the script, the result is emitted, captured by the enclosing context and turned into a template element.
However, in many cases it's desirable to define something like a resource and reuse it like:
$r = Resource ... {
}
In these cases, the value will be saved in the variable and will be reusable in other expressions, but will not be emitted.
Ideally we could have our cake and eat it too in some way; we need to make the scenario of passing template elements around as variables or other references more ergonomic. In particular:
- What's the best/most explicit way to emit a template element stored in a variable? Should it be as simple as stating the variable like
$r
or should we provide an explicit command to make it more obvious/readable and possible perform checks, likeResource $r
? - To what extent can or should we try to be clever with template variables being used and passed around in PSArm declarations? Should we just copy the value in, or try to cleverly calculate things like template references for deduplication?