JaggerScript / docsProject documentation

Reference

Allocation and Object Identity

Look up syntax, contracts, layouts, algorithms, and exact behavior.

Object construction allocates an Instance value on the heap, temporarily sets it as the running instance, evaluates global field definitions, restores the prior running instance, and finally evaluates the constructor body against the new instance.

new Class(args)
  |
  v
allocate pointer p
  |
  v
heap[p] = Value(Instance)
  |
  v
runningInstance = heap[p]
  |
  v
evaluate field definitions into globalScope
  |
  v
evaluate constructor(args)
  |
  v
return Instance pointer
Instance allocation. Field initialization and constructor execution both operate through the heap-backed instance scope.
x≡y⇔ptr(x)=ptr(y)x \equiv y \Leftrightarrow ptr(x)=ptr(y)
Object identity. Two object values are the same runtime object exactly when their heap pointers match.

Primitive values can be stored directly in stack frames, but object fields point into the heap. Reassignment to a field either reuses an existing heap-backed value or allocates a new heap slot and updates the owning instance's globalScope mapping.