Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The new text for type conversions in "10.3.2.9.4 Type conversions" misses some use cases #666

Open
StrayAlien opened this issue May 24, 2024 · 2 comments

Comments

@StrayAlien
Copy link
Contributor

The new text in 10.3.2.9.4 Type conversions is a welcome addition, but some situations are missed and left undefined in behaviour. There are a lot of places in a model that can explicitly define a typeRef. Having an explicit typeRef (IMO) has implications for implicit conversion. And it doesn't matter where it is ... everywhere that has a typeRef should be subject to the same implicit conversion as defined in this section - not just filters, invocations and DRG variables.

Here are just a few examples:

  • An InputData has a typeRef of (say) string, but the actual provided input value is a number. It should be coerced to null.

  • An InputData has a typeRef of (say) a collection of string, but the actual input value is just a simple string value. It should be coerced a singleton string list.

  • A boxed list has two elements. Element 2's expression has a typeRef of string. The executing expression actually returns a number. It should coerced to null with list being [, null]

  • A context entry has an expression with a typeRef of string. The actual expression returns a number. The value of the entry should become null.

That make sense?

I would add another element to the "There are several kinds of contexts in which conversions may occur:" section.

Something like:

"Any DMN element that may specify a typeRef may be subject to implicit conversion. If the explicitly-typed DMN element may have a value bound to it such as a DRGs element's variable, or an InputData's value then implicit conversion occurs on binding of the value. If the explicitly-typed DMN element provides a value, such as any boxed expression or Decision Service or BusinessKnowledgeModel, then its return value is subject to implicit conversion."

 <list>
     <literalExpression><text>"foo"</text></literalExpression>
     <literalExpression typeRef="number"><text>someFunctionThatReturnsString()</text></literalExpression>
 </list>

gives :

["foo", null]

.. or a BKM

<businessKnowledgeModel name="bkm_001" id="_bkm_001">
    <variable name="bkm_001"/>
    <encapsulatedLogic>
        <formalParameter name="arg1"/>
        <literalExpression typeRef="string">
            <text>someFunctionThatReturnsNumber(arg1)</text>
        </literalExpression>
    </encapsulatedLogic>
</businessKnowledgeModel>

should return null.

or ...

<inputData name="input_001" id="_input_001">
    <variable name="input_001" typeRef="string"/>
</inputData>

But the actual input data is ["foo"] .... it should be unboxed to a single value.

@baldimir
Copy link
Collaborator

From discussion on the meeting - This needs to be transformed into an RTF proposal. @StrayAlien, could you please write a complete list of things you thing needs to be updated in the section? Or is the current description complete? We could then work together on a proposal.

@StrayAlien
Copy link
Contributor Author

StrayAlien commented Aug 19, 2024

Raised here: https://issues.omg.org/issues/lists/unclassified#issue-55153. @opatrascoiu - I hope that makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants