Hi, Ludovic Courtès wrote:
>>>> The next question is how to handle multiple level like `attrByPath >>>> ["a" "b" "c"] default as', one possible way is to attribute selections >>>> inside the name of the selected attribute. >>>> >>>> as.{a.b.c ? default} >> I don't find this more intuitive than "as.a.b.c or default". > > IIUC Nicolas’ proposal is more flexible than ‘or’, because > “as.a.b.c or default” could mean any one of: > > - as.{a.b.c ? default} > - as.a.{b.c ? default} > - as.a.b.{c ? default} Mine also allows that: - as.a.b.c or default - (as.a).b.c or default - (as.a.b).c or default I.e. simply using the parentheses - no new syntax required. The idea is that the "." operator is changed from `expr "." attrname' to `expr "." attrpath ("or" expr)?'. So putting parenthesis around as.a or as.a.b gives you two applications of the "." operator, one without a default and one with a default. -- 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