Skip to content

Commit 13004f1

Browse files
cristianocclaude
andcommitted
Add changelog entries for the dynamic-import rework
Signed-Off-By: Cristiano Calcagno <ccrisccris@gmail.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PCtQiaDijUqA2fujQXvKUw
1 parent 86482f3 commit 13004f1

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,16 @@
2323

2424
#### :rocket: New Feature
2525

26+
- Allow dynamic import of `@scope`'d externals: `import(floor)` with `@val @scope("Math") @module("m")` resolves the scope chain inside the import (`import("m").then(m => m.Math.floor)`). Previously rejected. https://github.com/rescript-lang/rescript/pull/8582
27+
2628
- Add `@res.hoistedFunction` for emitting nested module functions as flat JavaScript exports. https://github.com/rescript-lang/rescript/pull/8402
2729
- Add source map support with linked, inline, and hidden modes. https://github.com/rescript-lang/rescript/pull/8393
2830
- Add `List.includes`, deprecate `List.has` in favor of `List.some`, and clarify the equality semantics of `List.includes` and `Array.includes`. https://github.com/rescript-lang/rescript/pull/8530
2931

3032
#### :bug: Bug fix
3133

34+
- Dynamically importing an external whose binding needs call-site adaptation (`@variadic`, `@unwrap`, poly-variant encodings, `@as` phantom arguments, optional labeled arguments, `@return` wrappers) now yields a value that behaves like its ReScript type: the import resolves to an adapting wrapper instead of the raw JS function, which was silently wrong at runtime (e.g. a `@variadic` import passed one array to a spread-expecting function). Identity bindings still hand out the raw value unchanged. https://github.com/rescript-lang/rescript/pull/8582
35+
3236
- Fix formatter breaking the opening brace of a functor module type's result signature onto a new line (e.g. `module Make: Pattern => {`). https://github.com/rescript-lang/rescript/pull/8519
3337
- Fix argument evaluation order when a function call is inlined: the beta reducer stacked argument bindings in reverse parameter order, so the last argument was evaluated first when arguments could not be substituted directly. https://github.com/rescript-lang/rescript/pull/8572
3438
- Preserve parentheses around multiplication, division, and modulo expressions used as exponents. https://github.com/rescript-lang/rescript/pull/8550
@@ -53,6 +57,7 @@
5357

5458
#### :house: Internal
5559

60+
- Resolve dynamic-import targets at translation: `Pimport` carries the imported module (and access path) directly instead of an argument expression that the backend compiled, discarded, and pattern-matched for its qualified head. The `dynamic_import` flags on `Pjs_call` and `Lglobal_module`, the conversion-context threading, the backend eta-import fixup, and both argument-shape allowlists are deleted; unsupported import arguments get deliberate diagnostics at the declaration site. https://github.com/rescript-lang/rescript/pull/8582
5661
- Represent externals structurally end-to-end: the declaration (name, module source, scopes, variadic, argument specs, return annotation) is the stored FFI representation, consumed directly by validation, signature inclusion, printing, and code generation. This removes the `Marshal`-encoded spec that rode in `pval_prim`'s second slot and every magic-byte sniff that recognized it; `Pccall` and the runtime `external_spec` shape are deleted (externals expand to their JS call form at translation, visible in `-drawlambda`); signature inclusion compares declarations, fixing two quirks where identical-after-alias-expansion declarations were rejected (object-external optional fields, and `unit` vs an alias of `unit` in result types — the latter also fixes external unit-return handling for alias result types); `%absfloat`, a latent compiler crash, is removed. The ast, cmi, and cmt magic numbers are bumped (`ResImpl01301`/`ResIntf01301`, `Caml1999I025`, `Caml1999T026`). https://github.com/rescript-lang/rescript/pull/8581
5762

5863
- Give nominal variants one canonical runtime layout: compute their JavaScript representation once after typing each declaration, replace positional constructor tags with semantic runtime descriptors, and make construction, matching, coercion, printing, diagnostics, and GenType consume the stored representation instead of reinterpreting annotations. Pattern matching keeps occurrence-specific plans local without adding another Lambda or Lam expression form. https://github.com/rescript-lang/rescript/pull/8579

0 commit comments

Comments
 (0)