tazjin/nix-1p

Parenthesis are used without defining their use and meaning in the Nix language

Opened this issue · 0 comments

Parenthesis ( ) are used in the example here:

({ a ? 1, b }@args: args.a) { b = 1; }

But their syntactical use and meaning in the Nix language has not been defined.

In the Nix language, parentheses are primarily used to group expressions, control the order of evaluation, and encapsulate language elements to disambiguate their boundaries within larger expressions.

[Edit] This usage does not fall into my previous definition:

inherit (otherAttrs) email; # equivalent to `email = otherAttrs.email`;

Should a statement about parenthesis include the syntax that can be used for "inherit"?

Also ( ) can be used to control the scope of the "with" statement:

in with attrs; (/* this is the scope of the `with` */)

Can ( ) be used to control the scope of variables in general? (visibility / lifetime scope?)