@Env
The type of env, which reads, writes, iterates, spreads, and
destructures like a Dict of variable names and values.
Use delete to unset a variable. Reading a name that is not set raises; use
get for a default instead.
Inherits from: MutMap[Str, Str], Func
Methods
(call)[R] vars body -> R overload 1 of 3
Calls body with overrides from a dict in place, restoring them when it
returns.
Parameters
| Name | Type | Description |
|---|---|---|
vars |
BaseDict[Str | Sym, Str | :INHERIT: | nil] |
The overrides, as for keyword arguments. |
body |
(() -> R) |
The block to call. |
(call)[R] body ...vars -> R overload 2 of 3
Calls body with the variables given as keyword arguments in place,
restoring them when it returns.
A nil value unsets a variable, and any other value is converted to a string
as written, so env N: 0x5 sets N to 0x5.
Parameters
| Name | Type | Description |
|---|---|---|
body |
(() -> R) |
The block to call. |
...vars |
Value |
Overrides by variable name. |
Example
(call)[R] *args ...vars -> R overload 3 of 3
Calls a block with variables overridden in place, restoring them when it returns.
Parameters
| Name | Type | Description |
|---|---|---|
*args |
Value |
|
...vars |
Value |