Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler should not rely on Js or Belt module being present #6836

Open
cknitt opened this issue Jun 27, 2024 · 3 comments
Open

Compiler should not rely on Js or Belt module being present #6836

cknitt opened this issue Jun 27, 2024 · 3 comments
Assignees
Labels
Milestone

Comments

@cknitt
Copy link
Member

cknitt commented Jun 27, 2024

This is in preparation for switching to the Core standard library.

Currently, the compiler relies on the presence of the Js and Belt modules for quite a few things, for example async/await (Js.Promise.unsafe_async/Js.Promise.unsafe_await) or array/list spread (Belt.List.concatMany/Belt.Array.concatMany).

You can find more such usages by searching for Lident "Js" or Lident "Belt" in the compiler sources.

This should be refactored so that functions from the runtime modules (caml_*) are used instead.

@cknitt
Copy link
Member Author

cknitt commented Jun 27, 2024

This also applies to type definitions. Js.Re.t is used somewhere, and the JSX PPX is using Js.Nullable.t.

So maybe there should also be a caml_types.res as a source for the type definitions used by Core, Js, Belt, etc.

@cknitt
Copy link
Member Author

cknitt commented Jun 29, 2024

The runtime modules are listed in this file BTW:

jscomp/ext/js_runtime_modules.ml

@zth
Copy link
Collaborator

zth commented Sep 12, 2024

This fixes arrays spreads to not rely on Belt: #7034

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants