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
Hello dear XSMP team !
An interesting point to raise to you here.
The context:
We put some
@Conston 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 likeRecieved String8 but was expecting Int32. After some analysis, I think that template matching fails forString8(because the return type isconst String8) and therefore the default/fallback template implementation of theExtractValueImpl::Execmethod 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 inAnySimpleHelper.cpp).I think that many things are fine here. I think that, maybe, an improvement could be to detect the presence of
@Constarguments 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