doc: Reword scoping section

"dynamic scope" is not accurate, so reword. The underlying idea is good however.
This commit is contained in:
John Ericson 2024-05-08 11:18:17 -04:00 committed by GitHub
parent 460d8fbaea
commit a5252c9979
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -423,14 +423,15 @@ inline/multi-line, enclosed within `/* ... */`.
## Scoping rules
Nix has constructs with
Nix is [statically scoped](https://en.wikipedia.org/wiki/Scope_(computer_science)#Lexical_scope), but with multiple scopes and shadowing rules.
* dynamic scope
* [`with`](#with-expressions)
* static scope
* primary scope --- explicitly-bound variables
* [`let`](#let-expressions)
* [`inherit`](#inheriting-attributes)
* function arguments
Static scope takes precedence over dynamic scope.
* secondary scope --- implicitly-bound variables
* [`with`](#with-expressions)
Primary scope takes precedence over secondary scope.
See [`with`](#with-expressions) for a detailed example.