diff options
author | Vincent Ambo <mail@tazj.in> | 2022-09-29T17·34+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-09-30T12·31+0000 |
commit | da1e3e9ac586747cf8d65a257f330706b051d06e (patch) | |
tree | af365aa397f8531af336a6926b199fd876da0c34 /views | |
parent | 9cd5f03835d9fcc5b3c8fb0173c4a46c10519bc5 (diff) |
feat(tvix/eval): implement nested keys r/5002
This finishes up the implementation of nested keys after the key insight that the nesting level does not need to be tracked, and instead the attribute iterator can simply be retained inside the structures as is (in an advanced state). With this implementation, when encountering a nested key, the Tvix compiler will first analyse whether there is already a matching binding that can be merged (i.e. a binding that is a literal attribute set), and perform the merge, or otherwise create a new recursive set of bindings in which the entry is inserted with the path iterator advanced beyond the first name component. With this, all the logic simply applies recursively until there are no more nested bindings (i.e. until all iterators are "empty"). Note that this has one (potentially insignificant) deviation from Nix currently: If a non-mergable value is supplied (e.g. `a.b = 1; a = 2;`), Tvix will emit a *runtime* error (whereas it is *parse* time in Nix) as the branch which could statically analyse this is currently unreachable. There's a TODO for this, so we can fix it up later. Change-Id: I53df70e09614ff4281a70b80eac7da3beca12da9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6806 Reviewed-by: sterni <sternenseemann@systemli.org> Tested-by: BuildkiteCI
Diffstat (limited to 'views')
0 files changed, 0 insertions, 0 deletions