You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Option-C enabler: make AffineScript-level string logic compile through
the static pipeline + Deno-ESM backend, resting on a thin honest
host-primitive layer instead of bespoke per-op externs.
typecheck:
- `++` (OpConcat) is now polymorphic over String and [T] — dispatched
on the synthesised lhs type. Was String-only, so `acc ++ [x]` (how
stdlib/string.affine's split/join accumulate) failed
`Unify(Array, String)`.
- `len` broadened from `Array[t]->Int` to `'a->Int` (stdlib/string
calls it on String and arrays; matches the interpreter + the
`.length` lowering).
- Bound the honest string/char primitives: string_get/string_sub/
string_find/to_lowercase/to_uppercase/trim/parse_int/parse_float/
char_to_int/int_to_char/show (resolve.ml already knew them).
codegen_deno:
- Lower those primitives + `++` (shape-dispatched `__as_concat`, so
array concat isn't string-coerced) to JS intrinsics. The lowering
table now applies to ANY matching call head (not only declared
externs) so AffineScript-level stdlib resolves...
- ...EXCEPT a same-named user definition shadows the intrinsic
(new ctx.local_fns guard) — fixes a user `fn len(xs: IntList)`
being hijacked into `.length` (NaN).
Net: ends_with/strip_suffix/find/int_to_string/string-&-array `++`
all work as real AffineScript over the primitive layer
(tests/codegen-deno/string_prims.{affine,harness.mjs}). Full Deno-ESM
suite green (5 harnesses); `dune runtest` unchanged (same 2 pre-existing
E2E Node-CJS vscode failures, 214 tests, zero new regressions).
Note: stdlib/string.affine itself still has a separate Resolution error
(angle-generic `Option<Char>` + unimported Some/None) — that file's own
issue, not the primitive layer; addressed in the consumer migration.
Refs #122.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
0 commit comments