$darkmode
| Elektra 0.11.0
    | 
Currently it is inefficient to detect the length of an array and it is impossible to know if a key (without subkeys) should be an array or not.
###empty_array as in yajl, problem: does not allow efficient access of first element#_...array, problem: is ambiguousStore length in metadata array of key, or keep metadata array empty if empty array. Only children that have # syntax are allowed in a valid array. The index start with #0. Both keyAddName("#12") or keyAddBaseName("#_12") is allowed to add the 13th index.
For example (ni syntax, sections used for metadata):
It is not allowed to have anything else than #5 in the metadata array, e.g. even #4 would be a malformed array.
With the metadata array in spec:/ the spec plugin will add the array marker with the correct length. This needs to be happening early, so that plugins can rely on having correct arrays.
For example:
Here, the spec plugin would add array=#1 to user:/myarray if it was not there before.
To look up an array, first do ksLookupByName (ks, "/myarray", 0) on the parent. With the last index you get from its metadata array, iterate over the children. A cascading lookup on every individual child is also needed to make sure that overrides on individual elements are respected.
For example:
The spec plugin should check if it is a valid array, i.e.:
array,array,# children, and#0 to #n, without holes.binary metadata but without its problems.#0.# intermixed with non # keys) which is a possibility also in all the alternatives of this decision.user:/ or dir:/ key can change the semantics of a system:/ array, if not avoided by spec.