On structures like maps or arrays there are different possibilities which keys are looked up in the KeySet and which are simply iterated.
Without any guidelines, applications would provide arbitrary inconsistent behavior.
- Applications that have good reasons to ignore the guidelines (e.g. they only read from one namespace), are allowed to do so.
- only lookup the roots and then iterate over the next keys
- let the applications do what they want without any guideline
Every key that an application wants to use, must be looked up
with ksLookup
using a cascading lookup key.
- very simple rule, easy to understand, easy to follow
- provides consistent behavior (
spec
is always honored) ksLookup
is quite cheap as it has only a few simple loops, only one allocation and less then 10% of CPU time in profiling, even in very simple applications with many lookups.
Needs some helper functions or support in bindings as it is a bit tricky to implement e.g. for arrays.