-
Notifications
You must be signed in to change notification settings - Fork 15
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
More requirements for type information #1550
Comments
An
Obviously, the output cannot be complete for function items: Maybe we can ignore types like The function would allow people to do things like Maybe it will be easier for trivial use cases to only return the most specific type by default. We could add an options parameter to return alternatives, and control further details. |
@ChristianGruen your examples implies the signature This does simplify the specification a lot. I would argue that it should be So it is safe to use in cases where existence of a value is not guaranteed. I also explored how the output of fn:type as laid out above could be used to find a common type among sequences of items and created a gist of my proof of concept I do not claim correctness but want to share that here to discuss further and also show the applicability of @ChristianGruen's approach. |
The use-case is to give developers a way to answer the question "What is the type of this item?". |
If we allow the input to be optional, I think we should rather return the empty sequence instead of an |
Yes, this is exactly what I meant. |
What should item-kind() return for atomic items? The primitive type? The most specific non-anonymous type? |
See original issue #148.
There have been requests for further type information beyond that supplied by the four new functions
One of the requests was to be able to test if an item is a map, and array, some other function, a node, or an atomic value.
This could perhaps be done by broadening node-kind() to a function item-kind() that returns "map" for a map, "array" for an array, etc. We could also return the result in item-type syntax, say
map(*)
orarray(*)
orfunction(*)
.What else is needed?
The text was updated successfully, but these errors were encountered: