* New language feature: with expressions.
The expression `with E1; E2' evaluates to E2 with all bindings in the attribute set E1 substituted. E.g., with {x = 123;}; x evaluates to 123. That is, the attribute set E1 is in scope in E2. This is particularly useful when importing files containing lots definitions. E.g., instead of let { inherit (import ./foo.nix) a b c d e f; body = ... a ... f ...; } we can now say with import ./foo.nix; ... a ... f ... I.e., we don't have to say what variables should be brought into scope.
Showing
- corepkgs/buildenv/builder.pl.in 1 addition, 1 deletioncorepkgs/buildenv/builder.pl.in
- doc/manual/package-management.xml 21 additions, 13 deletionsdoc/manual/package-management.xml
- src/libexpr/eval.cc 24 additions, 4 deletionssrc/libexpr/eval.cc
- src/libexpr/lexer.l 1 addition, 0 deletionssrc/libexpr/lexer.l
- src/libexpr/nixexpr.cc 8 additions, 1 deletionsrc/libexpr/nixexpr.cc
- src/libexpr/parser.y 5 additions, 7 deletionssrc/libexpr/parser.y
- src/libexpr/primops.cc 1 addition, 1 deletionsrc/libexpr/primops.cc
Loading
Please register or sign in to comment