Skip to content

Resolve all KatScript parameters to references during compilation

finesse importer requested to merge fix/parsing-of-variables into develop

Fixes #351 (closed).

tl;dr: make myparam.T behave the same way in KatScript as &myparam.T currently does, and deprecate the & operator.

Changes all NAME tokens in KatScript to resolve to references, if possible. This will make any model parameters referenced in KatScript parse as ParameterRef. Non-model-parameters like nodes and ports will stay as-is.

This means & is no longer needed for references, because everything will now be a reference. The background to this can be read in the comments of #351 (closed), but in short, we decided the previous "pass by value" behaviour (e.g. with myparam.T) is almost never useful, and also probably not what the user expects.

The & operator remains supported, but is now a no-op. If it's used, a warning is printed telling the user this will not be supported in a future release. We should eventually make use of & a syntax error, and a new issue should be created to track this removal.

Side-effects to this change:

  • The directives that previously expected parameters to be passed by value, e.g. the target of an xaxis or lock, now get references. I had to modify the lock action to handle this, but xaxis seemed to already work without modification. This probably needs some discussion on how best to really solve.
Edited by finesse importer

Merge request reports