Closed gregsdennis closed 1 year ago
Well, I picked this hoping people would notice this... 🤡
We have two different cases that probably also need different answers.
The one the text addresses: A non-container, non-string value, e.g., length(3) I think I can argue that 1 is a good value for that.
The one the text does not address: An empty nodelist (Nothing).
1 is definitely not a good value for that.
Nothing speaks for -1 except FORTRAN-era conventions.
I think we want to be able to return Nothing here.
The one the text addresses: A non-container, non-string value, e.g., length(3) I think I can argue that 1 is a good value for that.
I disagree. I don't think the "length" of 3
is 1. I think it's nonsensical. Numbers, booleans, nulls, and Nothing
(really all that's left) don't have a "length." (We've also decided that we don't do any kind of type coersion, so interpreting length(3)
as length([3])
is invalid.)
I think we want to be able to return Nothing here.
I'm happy with this.
I'd be comfortable with length(3)
returning Nothing
.
For
length()
, the spec definesWhy return 1? That's a possible value for
length()
to return for valid inputs. Wouldn't it make sense to return a value that can't be returned by a valid input, like -1?Currently, this returns the both objects in the array, which is counter-intuitive. The length of the
authors
property in{"data": "no authors here" }
is nonsensical because it doesn't contain anauthors
property.