\subsection*{Problem}

Currently it is inefficient to detect the length of an array and it is impossible to know if an key (without subkeys) should be an array or not.

For the latter problem different workarounds exist, such as {\ttfamily \#\#\#empty\+\_\+array} in {\ttfamily yajl}.

\subsection*{Constraints}


\begin{DoxyItemize}
\item None
\end{DoxyItemize}

\subsection*{Assumptions}


\begin{DoxyItemize}
\item None
\end{DoxyItemize}

\subsection*{Considered Alternatives}


\begin{DoxyItemize}
\item {\ttfamily \#\#\#empty\+\_\+array} as in {\ttfamily yajl}, problem\+: does not allow efficient access of first element
\item store length (and not last element), problem\+: needs prepending of {\ttfamily \#\+\_\+...}
\item store element after last element (C++-\/\+Style), problem\+: very unusual style
\item use value and not metadata array, problem\+: is ambiguous
\end{DoxyItemize}

\subsection*{Decision}

Store length in metadata {\ttfamily array} of key, or keep empty if empty array. For example ({\ttfamily ni syntax}, sections used for metadata)\+:


\begin{DoxyCode}
myarray/#0 = value0
myarray/#1 = value1
myarray/#2 = value2
myarray/#3 = value3
myarray/#4 = value4
myarray/#5 = value5
[myarray]
  array = #5
\end{DoxyCode}


\subsection*{Rationale}


\begin{DoxyItemize}
\item Is very similar to {\ttfamily binary} metadata.
\item The key alone suffices to know if its an array
\item one can distinguish an array with keys that are called by chance \#0
\end{DoxyItemize}

\subsection*{Implications}


\begin{DoxyItemize}
\item yajl needs to be fixed
\item metadata library needs to be adapted
\item spec plugin needs to be fixed
\end{DoxyItemize}

\subsection*{Related decisions}


\begin{DoxyItemize}
\item \hyperlink{doc_decisions_global_validation_md}{Global Validation}
\end{DoxyItemize}

\subsection*{Notes}

\href{https://github.com/ElektraInitiative/libelektra/issues/182}{\tt https\+://github.\+com/\+Elektra\+Initiative/libelektra/issues/182} 