Skip to content

Spec: D119 Amendment 1 ruled — Vector[T, N], element first (Eric, 2026-10-12) - #2376

Merged
ehartford merged 1 commit into
mainfrom
spec-d119-amendment1
Oct 13, 2026
Merged

ehartford merged 1 commit into
mainfrom
spec-d119-amendment1

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Docs only (outside the battery's green-evidence inputs). Lands Eric's ruling on the D119 Amendment 1 brief: element first, Vector[T, N], aliases unchanged, rename one mechanical pass.

  • §4.3d carries the new spelling; §4.3a cross-reference, §16.1 C-vector import spelling, and ABI current-shape lines follow. Historical entries (spec changelog v7.11, ABI version history) keep the spelling they recorded.
  • D119 decision record: the Open point is closed as ruled; Mask[N, W] was not named in the ruling and keeps its order until ruled — flagged here for a one-word follow-up ruling either way.
  • Implementation is Array-length generics: fn f[N](xs: [T; N]) by Vector's mechanism (D119 Amendment 1) #2311 (rename pass + array-length generics); until it lands the compiler is non-compliant with §4.3d, per spec-leads.

…nt first

§4.3d spelled the count before the element (Vector[N, T]) while §4.3a
spells the element first ([T; N]); the D119 decision left the agreement
open for the array-length-generics brief. Ruled on that brief (#2311):
they agree, element first — Vector[T, N], the aliases (f32x4 and kin)
unchanged, the rename one mechanical pass. §4.3a's cross-reference,
§16.1's C-vector import spelling, and the ABI document's current-shape
lines follow; historical changelog and ABI version-history entries keep
the spelling they recorded. Mask[N, W] was not named in the ruling and
keeps its order until ruled — recorded in the D119 decision entry,
whose Open point this closes. The implementation (parser/Sema rename
plus array-length generics) is #2311; until it lands the compiler is
non-compliant with §4.3d by design, since the spec leads.
@ehartford
ehartford marked this pull request as ready for review October 13, 2026 02:40
@ehartford
ehartford merged commit 40cbc09 into main Oct 13, 2026
@ehartford
ehartford deleted the spec-d119-amendment1 branch October 13, 2026 02:40
ehartford added a commit that referenced this pull request Oct 13, 2026
…enerics (#2380)

* D119 Amendment 1 (#2311): Vector[T, N] element-first, and array lengths are generic parameters

§4.3d (ruled 2026-10-12, #2376): Vector writes its element first like
[T; N]; Mask[N, W] keeps its count first, as the ruling left it. The
internal type (d0 lane, d1 count) is unchanged — every resolver, the
frozen twins, the call-site binding walk, the declaration validator,
and the printers (diagnostics, c_import, bundle interfaces) swap the
two written arguments. The retired spelling with a literal count is
refused by naming the order. One Lexer-accurate pass renamed the tree's
40 unambiguous sites in tests (plus hand fixes inside f-strings, which
lex as one token); comments followed.

Array-length generics by Vector's mechanism: [T; N] binds a generic N
from the argument's array length in bind_type_params_from_type_expr
(nested nodes bind [T; N, N] and [T; R, C], with a conflict diagnostic),
as a TY_CONST_INT substitution. array_type_len and array_fill_count read
that substitution per instantiation and keep the length node in d2 —
each instance writes its own d1, the next re-reads d2; the frozen and
substitution resolvers bind the same way. type_expr_mentions_type_param
now counts a generic length as a mention: without it the expected-type
probe resolved [i32; N] with N unbound (erroring and consuming the
length node) before inference could bind it. A probe that resolves a
generic length under a non-integer substitution (template probe,
cascade suppression) is non-destructive and quiet — the one 'cannot
infer' diagnostic owns the failure.

Tests: behav_d119a1_vector_element_first (dot[N] over Vector[f32, N],
aliases unchanged), behav_d119a1_array_length_generics (total[N],
trace[N], transpose[R, C] incl. [0; C, R]), err fixtures for the retired
spelling and a length conflict. A bracket literal still takes no
generic array demand — pre-existing on main, filed as #2379.

* Re-record the ABI hash for the TypeLayout comment (Vector[f32, 3] spelling)

The Amendment 1 comment sweep changed bytes in an ABI-defining source;
the convention did not change, so the hash is re-recorded with no
WITH_ABI_VERSION bump. Every .wo rebuilds once.

---------

Co-authored-by: Eric Hartford <[email protected]>
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.

1 participant