Skip to content

ESC-04: ReScript block-module — multi-module-per-file has no clean target (Refs 229) #262

@hyperpolymath

Description

@hyperpolymath

Problem

ReScript module Name { … } block modules have only a partial
AffineScript target. AffineScript is strictly one module per file
(grammar parser.mly:130-134: a single optional module Path; header,
before imports; no block-module form — module A { } parse-errors).

  • Single block-module per file (<comments> ; use…; ; module P { body })
    → mechanical clean target: hoist module P; header to the top, drop
    the wrapping braces, dedent the body, keep use after the header.
    This is in the canonical map (RESCRIPT-ELIMINATION.adoc, structural
    Tier-1) and verified to parse.
  • Multiple block-modules in one file (e.g.
    standards/lol/src/cyc/OpenCyc.affine: module Config { } module Concepts { } module Types { } …) has no clean target: it cannot
    collapse to one file-header without a semantic re-design (split into N
    files, or a namespacing decision). 14 estate occurrences across
    block-module-bearing files (post-LANG: type/effect grammar has no module-qualified path — Pkg.Type/Pkg.Effect unrepresentable (estate-wide port blocker; ADR-014) #228 re-audit; tools/estate-rs-audit/).

Escalated language-side rather than guessed per-repo — the same
bidirectional-evidence discipline as ESC-01..03 / #228.

Decision needed

One of:

  1. Doctrine: split per file. Each module X { } becomes its own
    X.affine with a module …; header (mechanical once the split
    convention + loader path mapping is fixed — see the cross-module
    resolution note below).
  2. Add a block/nested-module form to the grammar (ADR), if
    multi-module-per-file is a wanted AffineScript feature.

Related (not this issue, but adjacent)

Even single-block-module files that port cleanly parse then hit
Resolve.UndefinedModule because the repo's module-path↔file-layout
(e.g. idaptik-dlc-vm/src/State.affine declaring module Vm.State;)
does not match the module loader's resolution. That is cross-module
graph coherence (INT-02 loader-bridge territory)
, explicitly out of
#229's per-file contract — tracked in RESCRIPT-ELIMINATION.adoc Tier-4,
not here.

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions