tazjin / nix-1p

A (more or less) one page introduction to Nix, the language.
https://code.tvl.fyi/about/nix/nix-1p
896 stars 24 forks source link

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

Open WayneSherman opened 7 months ago

WayneSherman commented 7 months ago

Parenthesis ( ) are used in the example here: https://github.com/tazjin/nix-1p/blob/1cf10d3fb78d2500ea46640492e0a92aeda5fe69/README.md?plain=1#L289

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: https://github.com/tazjin/nix-1p/blob/1cf10d3fb78d2500ea46640492e0a92aeda5fe69/README.md?plain=1#L344 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: https://github.com/tazjin/nix-1p/blob/1cf10d3fb78d2500ea46640492e0a92aeda5fe69/README.md?plain=1#L363 Can ( ) be used to control the scope of variables in general? (visibility / lifetime scope?)