3.6. kink/ENV

The companion mod for env vals.


:prog <- PROGRAM.compile('Num * 2')
:Env <- ENV.new
Env:Num <- 42
stdout.print_line(prog(Env).repr) # => 84

3.6.1. type env

An env val is a holder of local variables, which can be used as a context environment register of execution of a Kink program.

See “Language specification” → “Kink Stack Machine (KSM)” chapter for context environment registers.

Env vals have the same variables as kink/CORE mod have when the runtime is initialized, except for CORE.repr.


Env.repr returns a str such as "Env(val_id=42)".

3.6.2. ENV.new

ENV.new makes a new env.

3.6.3. ENV.env?(Val)

Returns whether the Val is an env val.