Skip to content
PT

Static copy

Copied from docs/en/decisions/adp-001.md in https://github.com/poppy-team/aipo-lang (MIT). Pinned to revision ce47c4e070404fc41722ccd8e2b7b808b99062a8, blob 5cafae0c95500ebd92a13a8c715f93a148f9057f. The source repository remains canonical; this copy is refreshed through a sync pull request, not live.

ADP-001 — Core Types and Bytes as Values ​

  • Status: Approved & Implemented
  • Deciders: Poppy Team
  • Phase: Wave 1 (P00-G13 / P00-G15)

Context ​

The Aipo language required a clear strategy for handling raw binary byte streams, collection slicing, and bounded mathematical clamping operations.


Decisions Taken ​

  1. Bytes as a First-Class Value Type:

    • Bytes is represented in the VM as a contiguous buffer of unsigned 8-bit integers, exhibiting value semantics and reference counting.
    • Provides strongly-typed read and write operations with explicit endianness (read_u16_le, write_u32_be).
  2. Tolerant Slicing:

    • Collection slicing syntax (collection[start..end]) silently clamps out-of-range slice boundaries to the actual length of the collection, avoiding unnecessary runtime panics during safe read-only operations.
  3. Inverted Bounds Handling in clamp:

    • Invocations of clamp(val, min, max) where min > max trigger an explicit domain fault rather than yielding corrupted or undefined outputs.