Attempt to properly implement ? and + signature semantics#777
Open
mikhail-barg wants to merge 1 commit intojsonata-js:masterfrom
Open
Attempt to properly implement ? and + signature semantics#777mikhail-barg wants to merge 1 commit intojsonata-js:masterfrom
? and + signature semantics#777mikhail-barg wants to merge 1 commit intojsonata-js:masterfrom
Conversation
Contributor
|
While I would agree that the docs do not seem to match the current behavior, I do believe this is a breaking change, because it changes how function arguments are set. JSONata scripts written before this change would have no guarantee of working the same after this change. I think this is a step in the right direction for function signatures, but I also think we need to examine this issue a little deeper before making v3.0. For example, there are still other [undocumented (oops)] issues with how function signatures work that we should make an effort to address/correct in the same version jump (imo). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR attempts to address #776
I'm referring to the docs on
+and?and my interpretation of these lines is as follows:?does not match anything, it gets no value => getsundefined;+matches multiple values, it gets an arry of these values as a value (because there's no other way to pass multiple values into a single argument), so:n+matching1.0would result in a literal1.0n+matching1.0, 2.0, 3.0woul result in array[1.0, 2.0, 3.0]As you may see, I've only changed recently added 035 and 040 tests to match the semantics above, so I believe this change is not a major breaking change. It's more like covering previously vague topic. I've also added a number of tests to display the behaviour more explicitly.
@andrew-coleman what do you think?