-
Notifications
You must be signed in to change notification settings - Fork 36
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
Optional fn params vs null values #643
Comments
Hi @opatrascoiu - if we may, I'd like to go into this PR next meeting. Some stuff I don't quite get - like many of the |
Regarding #643 (comment). According to the XML spec
Also in FEEL the |
@StrayAlien Regarding These test cases were extracted from the XML test suite (see link at the top of the test files). I should have set the errorFlag to true. PR #648 addresses that. Well spotted ! |
Hi @opatrascoiu , I hope you are well. My apologies for letting the one take so long to repsond. It is not so much about the XML spec, or these specific functions. It is more about whether, as a general thing in DMN, passing The act of passing a I hope that makes sense. |
Hi all,
Regarding the recent
1111-feel-matches-function.dmn
PR. It has a number of tests in it that use anull
value where an optional function parameter is specified .. like this:matches("abracadabra", "bra", null)
. The last parameter is defined by the spec as an optional string value.Some of the tests are asserting passing a null value is the same as having actually not passed a value at all, like treating
matches("abracadabra", "bra", null)
as if it were reallymatches("abracadabra", "bra")
. They're good tests and are specifically testing for that situation. Cool. Looking at other tests where there are optional params it looks we may have totally missed this assertion - certainly I have missed it in a number of test suites I have submitted - mea culpa.My take on this is they are not the same and the actual return value should be
null
. That is, with an invocation likematches("abracadabra", "bra", null)
.. it actually is passing a value to the function ... it has provided anull
where there are specific domain constraints. In this case it is not a valid value, therefore, it is an invalid argument.A
null
does not conform to the above. (or does it?! - opinions welcome!).IMO, if you actually pass an argument it must match the parameter domain constraints - if not, the result should be
null
. And passingnull
is not the same as not passing an argument.If the spec says otherwise, cool - lemme know. It would not be the first (or last!) time I am wrong, but, I feel there is a difference between passing a null value as an optional value, and not actually passing a value.
Greg.
The text was updated successfully, but these errors were encountered: