Language / Memory model

Memory model

This page is a learning-oriented companion to the canonical memory model: memory model.

At a high level:

  • Most values are plain, copyable scalars (or structs that lower to a fixed set of scalar slots in Silk).
  • Heap allocation is introduced via new, producing &Struct references.
  • with regions can redirect new allocations away from the heap (see regions).

Notes#

Example: new + reference field access#

struct Point {
  x: int,
  y: int,
}

fn main () -> int {
  let p: &Point = new Point{ x: 1, y: 2 };
  return p.x + p.y;
}

See also#

Source repository · Edit this page · View Markdown