Commit graph

108 commits

Author SHA1 Message Date
Vincent Ambo
175eb97505 feat(tvix/eval): construct internal attribute path representation
This is required for constructing nested attribute sets at runtime.

There'll be quite a lot of optimisation potential with this solution
eventually, if it should turn out to be a bottleneck.

This introduces a conceptual change, in that the `Value` enum is now
an enum representing "all runtime values" instead of "all Nix language
types". This makes sense in general, as this type will also contain
Chunk representations etc. which are not exposed to users.

Change-Id: Ic5f72b2a0965b146c6a451efad34c6a81ca1aad8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6103
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
2022-08-13 20:24:12 +00:00
Vincent Ambo
e876c3a41c fix(tvix/value): KV struct needs to carry name as Value, too
Users may construct a pair that falls into the name/value optimisation
but where `name` is not actually a string, as from the language
perspective there is nothing special about this attribute set.

We also can not conditionally apply this by forcing the key at this
point, as this would change the language semantics.

Therefore, the name in the optimised representation is also carried as
`Value`.

Change-Id: I5be8a4c98ba19ebdfb7203a929f714a04492512e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6101
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
2022-08-13 20:24:12 +00:00
Vincent Ambo
2dcbbb8c4a feat(tvix/value): implement Display properly for lists
Change-Id: I991d235cf52fbd42eb839b384f9c55ee64fa86c4
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6100
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2022-08-13 18:28:36 +00:00
Vincent Ambo
c67747cbe1 feat(tvix/value): add runtime representation of simple lists
There might be more logic in the future to encapsulate different
backing implementations of lists as well.

Change-Id: Ib7064fab48bf88b0c8913b0ecfa2108177c7c9fd
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6093
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Autosubmit: tazjin <tazjin@tvl.su>
2022-08-13 15:35:24 +00:00
Vincent Ambo
e24248df3b feat(tvix/value): add some necessary helpers for strings
Deriving Ord/Eq is required for the ordered BTreeMaps. Once interning
is implemented this will require some extra magic for the sort order,
but that's fine.

Change-Id: I0c654648eb3609a4a01d84868c25f43a4d35bc2e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6089
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2022-08-13 11:50:37 +00:00
Vincent Ambo
2ed38a7cdb feat(tvix/eval): add Value variants for strings & attrsets
Change-Id: Idebf663ab7fde3955aae50f635320f7eb6c353e8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6087
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2022-08-13 11:50:37 +00:00
Vincent Ambo
ba03226e51 feat(tvix/eval): add module for attribute set implementations
Change-Id: I6002bd5e5596b93325dea6c862370ba5235c0f08
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6086
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2022-08-13 11:50:37 +00:00
Vincent Ambo
d26c097d1b feat(tvix/eval): add module for string type implementation
Change-Id: I5e4465acc4a676c10d7374b14f7a09240202b466
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6085
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
2022-08-13 11:50:37 +00:00