Zuzu::Env(3)

NAME
Zuzu::Env - lexical environment used for variable bindings

DESCRIPTION
Stores lexical bindings as references, tracks const-ness, and resolves names through parent scopes.

INHERITANCE
Inherits from "Moo::Object".

ROLES
None.

ATTRIBUTES

  parent
Type: Maybe[InstanceOf["Zuzu::Env"]].

Enclosing lexical scope, or undef for the global scope.

  slots
Type: HashRef[ScalarRef].

Variable storage map from names to scalar references.

  const
Type: HashRef[Bool].

Const-ness map; true entries cannot be reassigned.

  weak
Type: HashRef[Bool].

Weak-storage map; true entries store weakable values as weak references.

METHODS

  new
Constructs and returns a new instance of this class.

  declare
Declares a new name in the current environment.

  alias_to_ref
Binds a name to an existing scalar reference.

  find_ref
Finds a variable reference in current or parent scopes.

  is_const_here
Reports whether a locally-declared name is const.

  is_weak_here
Reports whether a locally-declared name uses weak storage.

  is_weak_slot
Reports whether a name uses weak storage, resolving through parent scopes.

  set_weak_slot
Updates the weak-storage flag for an existing name.

SEE ALSO
Subclasses: none in this distribution.

COPYRIGHT AND LICENCE
Zuzu::Env is copyright Toby Inkster.

It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.