Skip to content

Const arguments in published operations #188

@Renaud-Marteleur

Description

@Renaud-Marteleur

Hello dear XSMP team !

An interesting point to raise to you here.

The context:

We put some @Const on operation arguments. This was not necessary but still, we did it. This lead to a valid xsmpcat, a valid smpcat, a valid code that builds. At runtime, trying to invoke those operations lead to something very strange and hard to debug.

Basically, @Const String8 def MyOperation() leads to a code that will throw something like Recieved String8 but was expecting Int32. After some analysis, I think that template matching fails for String8 (because the return type is const String8) and therefore the default/fallback template implementation of the ExtractValueImpl::Exec method is used. That default implementation only handles integers (and it is normal as other types shall be handled by specific instantiation of the template). (see ESA CDK code in AnySimpleHelper.cpp).

I think that many things are fine here. I think that, maybe, an improvement could be to detect the presence of @Const arguments and not generate code for invocation in such case (maybe add a comment in the code, like: // Operation 'MyOperation' not invokable because of const arguments).

Hoping that this is useful to you.

Renaud

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions