Skip to content

Add a focused pointers and fixed arrays example #659

Closed

Description

@LunaStev

Why

Pointers, address-of expressions, deref, fixed-size arrays, and pointer parameters are fundamental Wave features, but the current examples only show them as pieces of larger programs such as struct_proto_semantics.wave, game.wave, and the WebAssembly smoke modules.

A smaller example would make the supported pointer/array model easier to understand without requiring readers to extract it from unrelated code.

Scope

Add a focused runnable example under examples/ that demonstrates:

  • taking the address of a variable with &;
  • declaring and passing ptr<T> values;
  • reading and modifying a value through deref;
  • declaring and indexing a fixed-size array<T, N>;
  • passing a pointer to the first array element to a helper function.

Keep the example within ordinary safe-to-run hosted code. Do not expand it into allocator, raw syscall, FFI, or ownership semantics.

Completion criteria

  • The example passes wavec check and wavec run on a supported hosted target.
  • A pointer-based helper visibly updates caller-owned data.
  • Fixed-array indexing and pointer access are both demonstrated.
  • The code avoids undefined out-of-bounds or dangling-pointer behavior.
  • The example is listed in the examples index or local README.

Activity

  1. added
    documentation
    good first issue
    needs testing
    on Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationgood first issueneeds testing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions