env — environment variables
Environment variables are a channel that changes behaviour quietly from outside the program. Reading one therefore takes cap env, and that fact shows in the head of the op (chapter 16). The module is one wrapper that passes the builtin op env_get through.
use env .
proc has_home input e cap env . output bool . effects none . do
let v option slice u8 env.get e. "HOME" . .
return is_some v. . .
end .| op | shape | notes |
|---|---|---|
env_get | (cap env, name slice u8) → option slice u8 | The value of the variable with that name. none when it is not set |
Table 50.1 — The ops of env
Not built: setting or removing a variable, listing all of them.