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

882 Replace fn:chain by fn:compose #1883

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

michaelhkay
Copy link
Contributor

Drops the existing fn:chain function and replaces it with a new fn:compose function.

This combines two separate changes:

(a) whereas fn:chain applies a sequence of functions to an input, fn:compose returns a composite function that can be used repeatedly with different inputs.

(b) the fn:compose function is restricted to arity-1 functions, which leads to a much simpler specification that still handles the vast majority of practical use cases.

In particular, note that if the sequence of functions to be applied is statically known, then it can always be written out explicitly; the real use case for this function is when the sequence of functions is constructed dynamically. And in this situation, fn:chain in its current form can easily fail because of problems with the arity of the functions included in the chain.

@michaelhkay michaelhkay added XQFO An issue related to Functions and Operators Enhancement A change or improvement to an existing feature Tests Needed Tests need to be written or merged labels Mar 16, 2025
@michaelhkay
Copy link
Contributor Author

Fix #882
Fix #1859

@michaelhkay michaelhkay added Tests Added Tests have been added to the test suites In Saxon 13 The feature is implemented in the Saxon 13 development branch and removed Tests Needed Tests need to be written or merged labels Mar 16, 2025
@michaelhkay
Copy link
Contributor Author

Discussed on 2025-03-18, discussion timed out. Generally the fn:compose spec is regarded favourably but there was pushback against dropping fn:chain.

@michaelhkay michaelhkay force-pushed the 882-replace-chain-with-compose branch from 5afb725 to c00c180 Compare March 20, 2025 09:30
@michaelhkay michaelhkay force-pushed the 882-replace-chain-with-compose branch from c00c180 to 74efd57 Compare March 25, 2025 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement A change or improvement to an existing feature In Saxon 13 The feature is implemented in the Saxon 13 development branch Tests Added Tests have been added to the test suites XQFO An issue related to Functions and Operators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants