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
{{ message }}
Repository navigation
[AI.a2ml] Add no-side-effect-imports directive for migration #50
Add a (no-side-effect-imports) directive: AffineScript modules don't run code at load time. Migrating ReScript/JS code that uses let _ = X.foo for module-load side effects must be rewritten to call an explicit registration function.
Source observation
idaptik's src/Main.res has 22let _ = X.constructor lines that exist only to trigger module-load side effects in JS-land. AffineScript compiles to wasm where there is no implicit module-load-time side effect to hook. The AffineScript translation in migration/main/Main.affine converts these to one explicit ScreenRegistry.registerAll(engine) call.
Suggested patch (LESSONS.md L6)
(directives
(no-side-effect-imports
(rule "AffineScript modules do not run code at load time. Migrating ReScript/JS code that uses \`let _ = X.foo\` for module-load side effects must be rewritten to call an explicit registration function.")))
Filed from idaptik Wave 3 pilot. See LESSONS.md and PILOT.md. Idaptik commit hyperpolymath/idaptik@aef38db.
Activity