Hi, Nicolas Pierron wrote:
>> Also, given that the question mark already has two different meanings >> (unfortunately), it shouldn't be used for a third. > > Meaning of "?": > - (set ? attr): Check if the set posses an attribute. > - (s...@{attr ? default}: ...): Check if the set posses an attribute, > otherwise set it to a default value. > - (set.{attr ? default}) Check if the set posses an attribute and > return its value, otherwise return the default value. > > what I see is that the "?" is associated to a check of the presence of > the attribute, and when it is placed inside brackets and after the > attribute this means that you define a default value. If "?" wasn't already an operator, I would prefer "a.b.c ? default". But unfortunately that's not the case. Disambiguating this by putting curly braces around it just looks weird because it makes it look like an attribute set or a function. >> Same goes for {...}, which is also already taken. {x ? default} looks too >> much >> like a function definition. > > Indeed, and that's the reason for it. Keep things familiar and not confusing. But it's not a function. That's very confusing. (Not to mention that the Nix syntax for functions isn't particularly clear to begin with.) -- 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