Comments (5)
Currently 4.6.2.3 Partial Function Application says that the name property of the returned function is absent, both for static and dynamic partial application. Are you proposing this should be changed for both cases (static and dynamic)?
The only objection I can see is that someone might assume that if a function item has name=fn:concat
and arity=2
then they can assume that the function in question is concat#2
, whereas under your proposal it might, for example, be concat(?, '-', ?)
. It feels a little confusing to me that you can have two function items with the same name and arity that do different things.
from qtspecs.
The only objection I can see is that someone might assume that if a function item has
name=fn:concat
andarity=2
then they can assume that the function in question isconcat#2
, whereas under your proposal it might, for example, beconcat(?, '-', ?)
.
My proposal would be to preserve the function name if the result of the partial application is identical to what a named function reference returns, which is only the case for what I tried to describe as “partially applied functions without applications”, i.e., if all arguments are placeholders. In other cases, the reference to the function name must be dropped, as the resulting function item is not equivalent to the built-in function anymore.
In contrast, function-arity
should always return the number of required arguments of a function item, i.e., it should return 1
for count#1
, count(?)
, concat(?, '-')
, fn($x) {}
, and fn {}
.
from qtspecs.
I think we must revise the definition of "partial application" and state that f(?, ?, ...?)
(all arguments substituted by ?
) is not a partial application - because there is nothing "partial" in this expression - in fact it is total freedom.
Probably any such total-freedom expression must be flagged as an error. Anyway, I pity the reader who would need to count the question marks...
from qtspecs.
My proposal would be to preserve the function name if the result of the partial application is identical to what a named function reference returns, which is only the case for what I tried to describe as “partially applied functions without applications”, i.e., if all arguments are placeholders. In other cases, the reference to the function name must be dropped, as the resulting function item is not equivalent to the built-in function anymore.
The number of actual expressions containing "“partially applied functions without applications”, i.e., if all arguments are placeholders." is likely indiscriminately close to 0.
Therefore, this new "feature" seems to be the solution to a non-existent problem.
from qtspecs.
The number of actual expressions containing "“partially applied functions without applications”, i.e., if all arguments are placeholders." is likely indiscriminately close to 0.
Nope; I’ve encountered this repeatedly in practice. Some people prefer to write sum(?)
instead of sum#1
.
from qtspecs.
Related Issues (20)
- XQFO Code in the Rules sections HOT 7
- fn:subsequence-where: equivalent `fn:slice` expression HOT 2
- Simulating Objects: Performance HOT 64
- Errors in forming function items (continued) HOT 4
- fn:has-attributes HOT 5
- Rewrite spec of deep lookup operator: edits
- XPath Appendix I: Comparisons
- XQFO: Context item → value
- fn:parse-json, fn:json-to-xml: `number-parser`, `fallback`
- Rules for context-dependent function references in XSLT (e.g. regex-group#1) HOT 1
- Identify optional arguments in callback functions HOT 41
- Add position argument to scan-left and scan-right HOT 3
- fn:reduce (or fn:fold without initial value) HOT 5
- Numeric Comparisons HOT 5
- character sequence constructor 'a' to 'z' HOT 21
- Transitive closure on non-nodes HOT 2
- Invisible-xml - missing details HOT 1
- Invoking maps & arrays: allow sequences? HOT 5
- regular expression addition - lookbehind assertions and lookahead assertions HOT 2
- regular expression addition - comments HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qtspecs.