nix-learn/nix-language/with.nix

32 lines
343 B
Nix

let
a = {
x = 1;
y = 2;
z = 3;
};
in
with a; [ x y z ]
# The following is equivalent to the previous expression
# let
# a = {
# x = 1;
# y = 2;
# z = 3;
# };
# in
# [ a.x a.y a.z ]
# Failing counter exmaple
#let
# a = {
# x = 1;
# y = 2;
# z = 3;
# };
#in
#{
# b = with a; [ x y z ];
# c = x;
#}