Skip to main content

Advanced: variable resolution & scoping

Jess has two variable-reference forms:

ReferenceResolution model
$fooLive: reads the current binding at evaluation time.
$$fooScoped/final lookup.

$foo: live

Use $foo when the value should follow the current binding at the point where it is evaluated.

$$foo: scoped/final

Use $$foo when you want the scoped/final lookup explicitly.

Missing names

Both forms report an unresolved name as a ReferenceError unless the caller is performing an explicit optional/existence operation.

Declaration and assignment lookup

FormBehavior
$foo: value / $$foo: valueCreate or update both bindings.
$foo?: valueCheck the live binding; create/update both if absent.
$$foo?: valueCheck the scoped/final binding; create/update both if absent.
$foo := valueUpdate the live/current binding.
$$foo := valueUpdate the scoped/final binding.