mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
move together all syntactic and semantic information into one page, and add a page on data types, which in turn links to the syntax and semantics. also split out the note on scoping rules into its own page. Co-authored-by: Ryan Hendrickson <ryan.hendrickson@alum.mit.edu>
14 lines
557 B
Markdown
14 lines
557 B
Markdown
# Scoping rules
|
|
|
|
Nix is [statically scoped](https://en.wikipedia.org/wiki/Scope_(computer_science)#Lexical_scope), but with multiple scopes and shadowing rules.
|
|
|
|
* primary scope: explicitly-bound variables
|
|
* [`let`](./syntax.md#let-expressions)
|
|
* [`inherit`](./syntax.md#inheriting-attributes)
|
|
* [function](./syntax.md#functions) arguments
|
|
|
|
* secondary scope: implicitly-bound variables
|
|
* [`with`](./syntax.md#with-expressions)
|
|
|
|
Primary scope takes precedence over secondary scope.
|
|
See [`with`](./syntax.md#with-expressions) for a detailed example.
|