|
|
@@ -25,9 +25,9 @@
|
|
|
> pre-register `X`), a `SymTab.EnterTypeParamBound`, a grammar
|
|
|
> instantiation context + accessors, and driver re-parse logic.
|
|
|
>
|
|
|
-> **Done (Increment 3, partial — 2026-10-16): value (constant)
|
|
|
-> parameters.** A generic formal may now be a value rather than a
|
|
|
-> type: `GENERIC DEFINITION MODULE Buf (size : CARDINAL); TYPE T = ARRAY
|
|
|
+> **Done (Increment 3 — 2026-10-16): value (constant) parameters and
|
|
|
+> actual-kind constraints.** A generic formal may now be a value rather
|
|
|
+> than a type: `GENERIC DEFINITION MODULE Buf (size : CARDINAL); TYPE T = ARRAY
|
|
|
> [0..size] OF CHAR; …` instantiated by `MODULE X = Buf(10);`. Grammar:
|
|
|
> `GenericFormal` collects its names then accepts `: TYPE` (type formal)
|
|
|
> or `: TypeIdent` (value formal); `Actual` accepts an integer, `charConst`
|
|
|
@@ -38,10 +38,21 @@
|
|
|
> On instantiation a value formal becomes a `CONST` bound to the actual
|
|
|
> value; in the **abstract template** it is a `CONST` with a placeholder
|
|
|
> value (`"0"`), so template parsing succeeds — templates are never
|
|
|
-> lowered, so only instances matter. Suite tests `BufProg` (and a
|
|
|
-> second instance, `Buf(3)`), verified end-to-end (`HIGH(T)` reflects the
|
|
|
-> bound size). Suite 209/209, fixpoint OK, corpus unchanged.
|
|
|
-> Procedure parameters / constraints remain for a later increment.
|
|
|
+> lowered, so only instances matter. **Constraints:** the actual's kind
|
|
|
+> must match the formal (a type formal needs a type actual, a value
|
|
|
+> formal a value one) — otherwise `233`; tested by `g_badbuf`.
|
|
|
+> Suite **210/210**, fixpoint OK, corpus unchanged.
|
|
|
+>
|
|
|
+> **Still open for inc3+:** *procedure parameters*
|
|
|
+> (`Compare : CompareProc`, actual = a procedure). These need two
|
|
|
+> mechanisms not yet present: (1) the refinement form
|
|
|
+> (`MODULE X = G(...);`) must accept `{ Import }` so the actual
|
|
|
+> procedure is visible; (2) a cross-parse **procedure alias** — clone
|
|
|
+> the actual proc's `SymNode` under the formal's name in the
|
|
|
+> instantiation scope (the `Materialize`/`MaterializeAlias` pattern,
|
|
|
+> which keeps `uid`/`mod` so mangling resolves). Also open: a
|
|
|
+> **constraint model** beyond kind-matching (e.g. "`T` must be
|
|
|
+> ordinal"), and `GENERIC CLASS`.
|
|
|
|
|
|
Study reviewed: `../Generics/` (the three `m2-generics-coco-r-*.md`
|
|
|
analyses, the `m2generic/` prototype: `M2Generic.atg`,
|