1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 23:11:16 +02:00

* Allow a default value in attribute selection by writing

x.y.z or default

  (as originally proposed in
  https://mail.cs.uu.nl/pipermail/nix-dev/2009-September/002989.html).

  For instance, an expression like

    stdenv.lib.attrByPath ["features" "ckSched"] false args

  can now be written as

    args.features.ckSched or false
This commit is contained in:
Eelco Dolstra 2011-07-13 12:19:57 +00:00
parent 2b9e29b1c8
commit 0a623a10c7
9 changed files with 70 additions and 22 deletions

View file

@ -121,10 +121,10 @@ struct ExprVar : Expr
struct ExprSelect : Expr
{
Expr * e;
Expr * e, * def;
AttrPath attrPath;
ExprSelect(Expr * e, const AttrPath & attrPath) : e(e), attrPath(attrPath) { };
ExprSelect(Expr * e, const Symbol & name) : e(e) { attrPath.push_back(name); };
ExprSelect(Expr * e, const AttrPath & attrPath, Expr * def) : e(e), def(def), attrPath(attrPath) { };
ExprSelect(Expr * e, const Symbol & name) : e(e), def(0) { attrPath.push_back(name); };
COMMON_METHODS
};