Skip to content

Add analysis of open type slot problem space in gt4py.next - #14

Open
havogt wants to merge 2 commits into
mainfrom
claude/loving-hopper-kcu6s6
Open

Add analysis of open type slot problem space in gt4py.next#14
havogt wants to merge 2 commits into
mainfrom
claude/loving-hopper-kcu6s6

Conversation

@havogt

@havogt havogt commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds a comprehensive design analysis document examining how gt4py.next represents not-yet-known and generic types, identifying structural issues in the current approach, and proposing a clean-slate redesign.

Changes

  • New document: content/ideas/havogt/open-type-slots.md

    • Analyzes the "open type slot" problem: how a single placeholder type (DeferredType / name is None case of TypeVarType) is overloaded to express six semantically different concepts
    • Maps these six roles onto a three-axis space (binding mode × sort × constraint) and explains why current designs (both the old two-class split and the recent ADR 0024 merge) are patches
    • Proposes a clean-slate design that splits the placeholder along its main axis into three constructs:
      • Absence of type information → Optional[TypeSpec] (kept out of type language)
      • Universal parameters → kinded TypeScheme/TypeParam/ParamRef (unifies dtype and dimension genericity)
      • Value-dependent returns → explicit type rules on builtins
    • Provides a pragmatic four-step migration path to reach the clean design incrementally
    • Surfaces representational tensions with the parallel "Generic dimensions" proposal and recommends sequencing
  • Updated index: Added reference to the new document in the ideas index

Context

This is a forward-looking design analysis (not a decision) that deliberately ignores backwards-compatibility to state the target design in its purest form. It builds on the dtype-generics work (ADR 0023) and critiques the subsequent merge (ADR 0024), with the decisive payoff materializing once dimensions become proper types. The analysis is intended to inform future generic work, particularly dimension genericity and scan redesign.

https://claude.ai/code/session_01BXfFm8Gbvt3ehckg8syNVN

claude added 2 commits June 17, 2026 16:40
Migrate docs/development/next/type-system-open-type-slots-analysis.md from
the gt4py repo into the knowledge garden as a havogt proposal.

- Knowledge-base frontmatter (title/author/tags/created) and house-style
  Status + Related blockquote.
- Cross-links the related proposals: dtype-generic-fields (ADR 0023, role
  R4), dimension-generic-fields (the dims-genericity payoff and the pivotal
  dependency), and scan-redesign (the R5 "scan hack" motivation).
- Adds a "Relation to other proposals and recommended sequencing" section
  recommending the redesign be pursued only after dimensions are proper
  types, and surfacing the representational tension with the asymmetric
  DimensionVar/DimsVar prototype in dimension-generic-fields §5.2.
- Index entry added under havogt, keywords in sync with tags.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXfFm8Gbvt3ehckg8syNVN
Rewrite the "open type slot" analysis to assume today's mainline gt4py
state -- DeferredType and TypeVarType as two separate classes (ADR 0023) --
rather than the post-merge state. The DeferredType/TypeVarType merge
(candidate "ADR 0024", branch-only, not in mainline) is now presented as an
evaluated alternative in a dedicated section (new §4) and argued to
consolidate along the wrong axis, instead of being treated as the landed
status quo under critique.

- New §4 "A tempting consolidation" describes and evaluates the merge idea
  (single TypeVarType with name-is-None discriminator, bound/constraints,
  DeferredType-as-factory) and why splitting Axis A beats collapsing it.
- §3 narrowed to the current two-class design's patchiness.
- Baseline note added to the status/related blockquote.
- Clean-slate design, trade-offs, migration path, and sequencing made
  merge-agnostic (the design absorbs the merge either way).

Title and index keywords unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BXfFm8Gbvt3ehckg8syNVN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants