Symptom
When a downstream Spinel program requires a library's source via a different relative path than the path the library uses in its own build, whole-program type inference fragments the type table differently. Concretely, an Array<Mat>-shaped declaration compiled clean but generated a C-codegen reference to an undefined sp_Mat type (sp_Mat undeclared) in the consumer, where Mat is a user class defined in the library.
Documented downstream in OriPekelman/toy (docs/consuming-toy.md, toy#19): hand-pathing require_relative "../toy/lib/.../transformer" (where Mat lives) into a consumer fragments inference vs. toy's own build.
Current workaround
Vendor the library's entire source tree in the exact layout the library compiles with (the spinelgems bundler-spinel convention). Same tree shape → inference stays monomorphic the way the library's own build expects. This works but makes library composition fragile off that golden path, and is a large part of why the vendoring convention has to exist.
Ask
A stable package / namespace identity so a user class (e.g. Mat) resolves to the same monomorphic C type regardless of the require path it's reached through — so a downstream program can compose a library's primitives without reproducing the library's exact directory layout.
Related
A minimal self-contained repro (one file required via two paths → divergent inference) is a TODO; filing now to capture the design need since it's the root of the downstream vendoring brittleness.
Symptom
When a downstream Spinel program
requires a library's source via a different relative path than the path the library uses in its own build, whole-program type inference fragments the type table differently. Concretely, anArray<Mat>-shaped declaration compiled clean but generated a C-codegen reference to an undefinedsp_Mattype (sp_Mat undeclared) in the consumer, whereMatis a user class defined in the library.Documented downstream in OriPekelman/toy (
docs/consuming-toy.md, toy#19): hand-pathingrequire_relative "../toy/lib/.../transformer"(whereMatlives) into a consumer fragments inference vs. toy's own build.Current workaround
Vendor the library's entire source tree in the exact layout the library compiles with (the spinelgems
bundler-spinelconvention). Same tree shape → inference stays monomorphic the way the library's own build expects. This works but makes library composition fragile off that golden path, and is a large part of why the vendoring convention has to exist.Ask
A stable package / namespace identity so a user class (e.g.
Mat) resolves to the same monomorphic C type regardless of the require path it's reached through — so a downstream program can compose a library's primitives without reproducing the library's exact directory layout.Related
bunifies with an unrelated #b) #1043 — Struct accessors / param names widening unrelated methods). Same "inference keyed on something non-semantic" shape, different axis (require path / layout here).gate-poly-degradeCI gate that fails on newcannot resolve … on poly … (emitting 0)warnings — it guards regressions of this class but not the root layout-sensitivity.A minimal self-contained repro (one file required via two paths → divergent inference) is a TODO; filing now to capture the design need since it's the root of the downstream vendoring brittleness.