-
Notifications
You must be signed in to change notification settings - Fork 903
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
Clarify primitive values in an array are nullable #1155
Conversation
Hmm, I think the intention here is still that |
I see - for background, the reason I checked this spect was I was thinking of changing an API from |
I think we might want some clarification here in the spec. AFAIR, the null-wording was added to make sure that parallel arrays (e.g. keys[i] mapping to values[i]) stay in sync. I don't think the intention was to require allowing null for arrays. But as the spec is now, it is indeed unclear. |
cc @tigrannajaryan (who was the original author of this change, IIRC) |
@@ -17,7 +17,7 @@ Attributes are a list of zero or more key-value pairs. An `Attribute` MUST have | |||
- The attribute key, which MUST be a non-`null` and non-empty string. | |||
- The attribute value, which is either: | |||
- A primitive type: string, boolean, double precision floating point (IEEE 754-1985) or signed 64 bit integer. | |||
- An array of primitive type values. The array MUST be homogeneous, | |||
- An array of nullable primitive type values. The array MUST be homogeneous, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... but I generally feel a primitive type isn't nullable ...
Note that the spec does not take this Java-centric view. "primitive" in this context means merely what is written in the spec:
A primitive type: string, boolean, double precision floating point (IEEE 754-1985) or signed 64 bit integer.
That said, I agree with your clarification, since strictly speaking the current wording is contradicting itself: it prohibits "null" on lines 19-20, then allows "null" on lines 33-39.
I am not sure "nullable" is fully understandable though. Should we be more explicit, e.g.:
An array of primitive type values or null values. The array MUST be homogeneous,
i.e. it MUST NOT contain values of different types. The only allowed exception to this rule is that certain array values may be null, while other values are not null (see more on arrays and nulls below).
This is just an idea - it may just be me but I generally feel a primitive type isn't nullable. Does anyone else think that? Having the word nullable here makes me less confused, "why does it talk about null below even though we're talking about primitive types".