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 ## 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 * primary scope --- explicitly-bound variables
* [`with`](#with-expressions)
* static scope
* [`let`](#let-expressions) * [`let`](#let-expressions)
* [`inherit`](#inheriting-attributes) * [`inherit`](#inheriting-attributes)
* function arguments * 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. See [`with`](#with-expressions) for a detailed example.