String concatenation

I am building a logging pattern in order to verify that my models execute as expected and all ports and bindings are well set. To do this I add an attribute to an item that flows throughout the system and keep concatenating the actions that the item traverse. However I cannot manage to concatenate the string with the Automator.

I did not find a function that makes Syside treat somePayload.log as a model-level string value in this context.

What I found:

  • The standard library does define string concatenation with +.
  • It also defines StringFunctions::ToString, via BaseFunctions::ToString.
  • But in Automator evaluation, producedPayload.log is currently resolving to the feature element Context_Configuration::Payload::log, not to a String value.
  • And ToString(…) does not help here, because Syside reports it is “not a model-level evaluable function”.

I verified this with isolated probes. For example:

  • previousLog := producedPayload.log evaluates to Context_Configuration::Payload::log
  • previousLog + “consumePayload_gb” fails with Invalid operator ‘+’ for types ‘element’ and ‘string’
  • ToString(previousLog) fails with Function ‘ToString’ is not a model-level evaluable function

The relevant library file confirms the intended language design:

  • StringFunctions.kerml defines:
    • function ‘+’ … { in x: String[1]; in y: String[1]; return : String[1]; }
    • function ToString specializes BaseFunctions::ToString …
  • But the Automator docs also make clear that only a limited subset of standard-library functions is currently evaluable, and ToString is not listed among the supported ones.
    Sources:
  • First Example
  • Expression Evaluation

So the blocker seems not to be my syntax. My expressions are conceptually right. The issue seems to be that Syside Automator is not reducing those feature-chain references to concrete string values during model-level evaluation.

See a snippet of my code:

action finishPayload_bb {
        in finishedPayloadFeedback;
        in item prebuiltPayload defined by Context_Configuration::Payload;
        out item finishedPayload defined by Context_Configuration::Payload;
        out prebuiltPayloadFeedback;

        assign finishedPayload.log := prebuiltPayload.log + "finishPayload_bb_";
    }

Have you updated Syside to the latest version? v0.8.5 added support for a bunch of standard library functions and reflection, ToString is among them. Do note that ToString is technically not defined for arbitrary elements as it is marked abstract.

assign finishedPayload.log := prebuiltPayload.log + "finishPayload_bb_";

Syside does not currently treat external assignments and bindings as anything other than structural elements. That is, they do not modify model values as far as interpreter is concerned. This requires more general model interpreter that supports evaluation of multiple statements that is not yet implemented.

1 Like