-
Bug
-
Resolution: Done
-
Major
-
RH294 - RHEL 8.4 1 20210818, RH294 - RHEL 8 1 20190531
-
None
-
ILT, ROLE, VT
-
en-US (English)
URL:
Reporter RHNID:
Section: -
Language: en-US (English)||||||||
Workaround:
Description: In chapter 3 section 1 "Managing Variables", subsection "Using Arrays as Variables", those are dictionaries, not arrays. The first example snippet of users is a dictionary of two entries, bjones and acook. Those two entries are the keys, and they can't be mathematically computed. Python and YAML also think of these as a dictionary as is mentioned later on the page.
This is important because in YAML, a true array is a list, not a dictionary. That's because it meets the definition: "a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key, stored such that the position of each element can be computed from its index by a mathematical formula." Lists are ordered, dictionaries are not.
I think the confusion came in because sometimes a dictionary can be called an "associative array", and I think someone writing loosely shortened that to "array".
This subsection should be retitled and the discussion worded more carefully.
Refs: https://yaml.org/spec/1.2/spec.html
"There are myriad flavors of data structures, but they can all be adequately represented with three basic primitives: mappings (hashes/dictionaries), sequences (arrays/lists) and scalars (strings/numbers)."
This subsection is covering mappings, not sequences, so they aren't arrays by the YAML definition.