Skip to content

Add a language-neutral rule to the type-discipline contract for values that share a primitive #15840

Description

@kyle-sexton

Parent

Refs #15661 (the map decision this implements).

Depends on

Outcome

The type-discipline contract says, in language-neutral words, that two values sharing a primitive type that must never be swapped each get their own type.

Demo: read the contract; the rule is there once, names no language, and its three synced copies match.

Source: Lauren Tan's pstack (cursor/plugins, MIT), pstack/skills/principle-type-system-discipline/SKILL.md:11: "If two arguments share a primitive type but mean different things, brand them".

Decisions

  • Owner, 2026-11-12: a take must land in its proper home. The contract is the home: its rules depend on no particular language. The rule exists today only in a TypeScript file.
  • Wording without a language: a distinct nominal type (a newtype, a branded type, a single-field wrapper) that only its parse produces.
  • It sits with the contract's existing line that a wrapper around values no code mixes up costs ceremony: this is the mixed-up case that line allows.
  • It takes no side on the open decision between a cast and a type guard.
  • Nothing here is a consumer setting.

Key interfaces

  • The type-discipline contract and its synced copies in planning, implementation and review.

Done when

  • The contract carries the rule, as one new row or an extension of the existing wrapper row.
  • The three synced copies are regenerated and the sync check passes, with a changelog fragment per carrier.
  • A search finds the neutral rule in exactly one source.
  • The pull request body names this repository's dogfooding step.

Out of scope

  • Editing or removing the TypeScript idioms page (the ecosystem-specifics cut owns that).
  • The cast versus type-guard decision.

Activity

  1. added
    agent-ready
    on Nov 13, 2026
  2. added theissue type on Nov 13, 2026
  3. self-assigned this
    on Nov 13, 2026
  4. kyle-sexton commented on Nov 13, 2026

    @kyle-sexton
    MemberAuthor
    No description provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-ready

Type

Fields

No fields configured for Task.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions