about summary refs log tree commit diff
path: root/src/libexpr/eval.cc
AgeCommit message (Collapse)AuthorFilesLines
2004-08-04 * Every real language has a `map' function.Eelco Dolstra1-1/+1
2004-08-04 * Allow primops with more that 1 arguments.Eelco Dolstra1-44/+37
2004-04-05 * When something goes wrong in the evaluation of a Nix expression,Eelco Dolstra1-29/+55
print a nice backtrace of the stack, rather than vomiting a gigantic (and useless) aterm on the screen. Example: error: while evaluating file `.../pkgs/system/test.nix': while evaluating attribute `subversion' at `.../pkgs/system/all-packages-generic.nix', line 533: while evaluating function at `.../pkgs/applications/version-management/subversion/default.nix', line 1: assertion failed at `.../pkgs/applications/version-management/subversion/default.nix', line 13 Since the Nix expression language is lazy, the trace may be misleading. The purpose is to provide a hint as to the location of the problem.
2004-03-30 * The recent change in nixpkgs of calling `stdenv.mkDerivation'Eelco Dolstra1-0/+5
instead of `derivation' triggered a huge slowdown in the Nix expression evaluator. Total execution time of `nix-env -qa' went up by a factor of 60 or so. This scalability problem was caused by expressions such as (x: y: ... x ...) a b where `a' is a large term (say, the one in `all-packages-generic.nix'). Then the first beta-reduction would produce (y: ... a ...) b by substituting `a' for `x'. The second beta-reduction would then substitute `b' for `y' into the body `... a ...', which is a large term due to `a', and thus causes a large traversal to be performed by substitute() in the second reduction. This is however entirely redundant, since `a' cannot contain free variables (since we never substitute below a weak head normal form). The solution is to wrap substituted terms into a `Closed' constructor, i.e., subst(subs, Var(x)) = Closed(e) iff subs[x] = e have substitution not descent into closed terms, subst(subs, Closed(x)) = Closed(x) and otherwise ignore them for evaluation, eval(Closed(x)) = eval(x). * Fix a typo that caused incorrect substitutions to be performed in simple lambdas, e.g., `(x: x: x) a' would reduce to `(x: a)'.
2004-03-28 * Added an operator `?' to test for attribute existence, e.g.,Eelco Dolstra1-1/+8
`attrs ? x' yields true iff `attrs' has an attribute named `x'.
2004-03-28 * Added an operator `~' to select paths within a derivation. E.g.,Eelco Dolstra1-0/+1
{stdenv, bash}: derivation { builder = bash ~ /bin/sh; args = ["-e" "-x" ./builder.sh]; ... } Here the attribute `builder' will evaluate to, e.g., `/nix/store/1234abcd...-bash-2.0.1/bin/sh'.
2004-03-28 * Added plain lambdas, e.g., `let { id = x: x; const = x: y: x; }'.Eelco Dolstra1-0/+7
`bla:' is now no longer parsed as a URL. * Re-enabled support for the `args' attribute in derivations to specify command line arguments to the builder, e.g., ... builder = /usr/bin/python; args = ["-c" ./builder.py]; ...
2004-03-19 * `null' is a normal form.Eelco Dolstra1-8/+11
2004-02-16 * Inherited attributes in recursive attribute sets are in scope of theEelco Dolstra1-6/+7
non-inherited attributes.
2004-02-04 * An attribute set update operator (//). E.g.,Eelco Dolstra1-0/+16
{x=1; y=2; z=3;} // {y=4;} => {x=1; y=4; z=3;}
2004-02-04 * Use a map to lookup primops.Eelco Dolstra1-15/+53
* Various performance improvements in the evaluator. * Do not link against unused (and missing!) libraries (-lsglr, etc.).
2004-02-03 * Verify that all variables in a Nix expression are defined.Eelco Dolstra1-9/+9
2004-02-02 * Added syntactic sugar to the construction of attribute sets toEelco Dolstra1-13/+17
`inherit' variables from the surrounding lexical scope. E.g., {stdenv, libfoo}: derivation { builder = ./bla; inherit stdenv libfoo; xyzzy = 1; } is equivalent to {stdenv, libfoo}: derivation { builder = ./bla; stdenv = stdenv; libfoo = libfoo; xyzzy = 1; } Note that for mutually recursive attribute set definitions (`rec {...}'), this also works, that is, `rec {inherit x;}' is equivalent to `let {fresh = x; body = rec {x = fresh;};}', *not* `rec {x = x}'.
2004-01-30 * Replaced the SDF parser by a substantially faster Bison/FlexEelco Dolstra1-0/+2
parser (roughly 80x faster). The absolutely latest version of Bison (1.875c) is required for reentrant GLR support, as well as a recent version of Flex (say, 2.5.31). Note that most Unix distributions ship with the prehistoric Flex 2.5.4, which doesn't support reentrancy.
2004-01-15 * Catch SIGINT to terminate cleanly when the user tries to interruptEelco Dolstra1-0/+2
Nix. This is to prevent Berkeley DB from becoming wedged. Unfortunately it is not possible to throw C++ exceptions from a signal handler. In fact, you can't do much of anything except change variables of type `volatile sig_atomic_t'. So we set an interrupt flag in the signal handler and check it at various strategic locations in the code (by calling checkInterrupt()). Since this is unlikely to cover all cases (e.g., (semi-)infinite loops), sometimes SIGTERM may now be required to kill Nix.
2003-11-25 * Allow integer bindings in derivations.Eelco Dolstra1-0/+1
2003-11-19 * Refactoring: put the Nix expression evaluator in its own library soEelco Dolstra1-0/+265
that it can be used by multiple programs.