ietf-wg-jsonpath / draft-ietf-jsonpath-base

Development of a JSONPath internet draft
https://ietf-wg-jsonpath.github.io/draft-ietf-jsonpath-base/
Other
58 stars 20 forks source link

Can a function type be Absent? #342

Closed timbray closed 1 year ago

timbray commented 1 year ago

I'm looking at 2.6.1 and wondering if it would be meaningful for a function to have a result type of Absent. How could such a function be used in a filter? If it is the case that this doesn't make sense, that should probably be noted in the text.

gregsdennis commented 1 year ago

By "absent" do you mean "no return value," like a void function in C? If so, what would be the point? The usefulness of functions is that they perform calculations on inputs and provide a result.

cabo commented 1 year ago

Indeed, the clarification should be that not all types that make up the type hierarchy are useful as return types. (Which does not mean they need to be outlawed -- they are just not useful.)

glyn commented 1 year ago

By "absent" do you mean "no return value," like a void function in C? If so, what would be the point? The usefulness of functions is that they perform calculations on inputs and provide a result.

No. Absent is a type with one instance (Nothing).

glyn commented 1 year ago

I can just about conceive of a logging function that doesn't need to return a value returning type Absent. It could be used in a filter expression like this ... && !log(...). I'm not suggesting that's a good idea, but it could be done.

gregsdennis commented 1 year ago

That has no impact on the output of the query, though. Why would one include such a thing? Logging is an implementation/application concern.

No. Absent is a type with one instance (Nothing).

What? I'm asking about the meaning of Absent. How is it used? What's it's purpose? It doesn't appear in the spec anywhere, so why even ask the question?

cabo commented 1 year ago

2023-01-10 Interim: Remove Absent type.