Hi all,

Currently there are many places in the Nixpkgs and NixOS expressions where we
have to select a possibly missing attribute from a set, e.g.

  attrByPath ["extraModules"] [] mainCfg

or

  getConfig ["python" "db4Support"] true

Writing `attrByPath ["a" "b" "c"] default as' is rather verbose and ugly
compared to selecting an attribute without a default, i.e. `as.a.b.c'.

Since this is fairly common, how about some special syntax for supplying a
default value to the "." selection operator?  I propose the optional "or"
keyword following an attribute selection "x.<attrpath>".  E.g.

  mainCfg.extraModules or []

or

  config.python.db4Support or true

Comments?

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/
_______________________________________________
nix-dev mailing list
nix-dev@cs.uu.nl
https://mail.cs.uu.nl/mailman/listinfo/nix-dev

Reply via email to