Skip to content

Variables Up

Benedict Albrecht edited this page Jun 2, 2026 · 4 revisions

Variables: :up Scope

The :up scope makes a variable visible for all siblings and their (including the object's) downstream elements, as well as their upper element. If the upper element is a file, it is visible for file references.

Syntax

<< name:up >>

Example

class C1 ( ) {
  F2() ;

  function F1 ( ) {
    F2();
  }

  function F2 ( ) {
    F2();
  }
}

With :up scope

<:function:> function <<name:up>> ( ) { <---> } <:>
<:ref:> <<'name'>> ( ) ; <:>

F2 is visible to:

  • The parent scope (F2() at the top of C1)
  • All sibling objects (F1 can call F2())
  • Its own downstream (recursive call within F2)

Compared to default (:following)

<:function:> function <<name>> ( ) { <---> } <:>
<:ref:> <<'name'>> ( ) ; <:>

With default scope, F2 would only be visible to younger siblings and their downstream - it would not be visible to F1 (an older sibling) or the parent scope above it.



In Practice

The Basics grammar uses :up on imports, classes, and functions:

Declaration Why :up?
import <<name:up>> Imported name must be visible to sibling objects. In testFile.txt, C2 is imported and then used in C2.F3() and C2.F4().
class <<NAME:up>> Class name must be visible to siblings and the parent file. C1 is used by refference objects at file level.
function <<NAME:up>> Function name visible to parent class. F1 and F2 are referenced via C1.F1() using dependency selection.

Without :up, the refference objects at the bottom of testFile.txt would not be able to resolve C1, C2, F1, etc.

See Repo Analysis - Variable Resolution for the full resolution walkthrough.


See also: :following · :down · :siblings · :global · :hook

Clone this wiki locally