Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
WayneSherman opened this issue Feb 2, 2024 · 0 comments

Comments

@WayneSherman
Copy link

WayneSherman commented Feb 2, 2024

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?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant