12. Pointers, references and memory (pocket version)

TL;DR (5 lines)

  • Low-level surfaces need narrow boundaries.
  • The chapter should explain risk and ownership first.
  • Unsafe examples should stay explicit.
  • The reader should learn where the boundary belongs.
  • Reviewability matters more than token novelty.

Concrete Problem

Low-level chapters become dangerous when they show syntax without ownership, lifetime, or boundary reasoning.

Coherent example

space demo/pointers

unsafe proc write_value(dst: ptr[int], value: int) -> int {
  give 0
}

Global explanation

Pointer chapters are about boundaries. The goal is not to normalize low-level code everywhere, but to show how a narrow low-level surface can remain explicit and reviewable.

Short exercise

Wrap the low-level helper behind a higher-level procedure that exposes a safer contract.

Next best action

Keep the example small, reproduce it locally, then continue to the full chapter if you need the broader context.