Allow empty multi-select-list and multi-select-hash #93
Closed
innovate-invent
started this conversation in
Ideas
Replies: 2 comments 3 replies
-
|
Beta Was this translation helpful? Give feedback.
3 replies
-
This has been included in Compact Syntax for multi-select-hash |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There are a few situations where it would be useful to instantiate an empty array/object.
This is particularly important for reduce() to be able to pass an empty value as the init expression.
This could also be used with the arithmetic operators for a fallback operand, ie:
(a || {}) + {foo: 5}
in the event thata
is undefined or otherwise falsey. A more advanced example:(type(a) == 'object' && a || {}) + {foo: 5}
.I believe there is room in the grammar to allow
{}
to represent an empty object, but[]
currently refers to the flatten operator.We could have to_array() accept zero arguments and return an empty array.
[`null`][]
is an existing and valid way to get an empty array. This could be shortened to[a][]
assuming 'a' is undefined in the context.Are there any better ways to do this?
The proposed grammar change is:
Beta Was this translation helpful? Give feedback.
All reactions