Skip to content

Uncurried mode doesn't propagate to built-in stdlibs. #6147

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

Closed
DZakh opened this issue Apr 14, 2023 · 3 comments
Closed

Uncurried mode doesn't propagate to built-in stdlibs. #6147

DZakh opened this issue Apr 14, 2023 · 3 comments
Labels
stale Old issues that went stale

Comments

@DZakh
Copy link
Member

DZakh commented Apr 14, 2023

I have the rule to add a type definition when I use Obj.magic for casting types. In this case, it becomes more explicit, and the compiler at least can check that input and output types are used correctly. How can I do the same in the uncurried mode? Looks like the uncurried: true doesn't propagate to the built-in stdlibs.

image

@DZakh DZakh changed the title How to type a curried function in uncurried mode? Uncurried mode doesn't propagate to built-in stdlibs. Apr 14, 2023
@cristianoc
Copy link
Collaborator

cristianoc commented Apr 14, 2023

It should propagate to pervasives.

At the moment trying not to make 2 copies of everything. So perhaps it's just that Obj.magic is not in pervasives.
In this case:
let magic = x => magic(x) should do.

Later on, we can assess how many things we want 2 copies of.
Note, if one uses things from Core being it an external library, it will be compiled in uncurried mode.
So we might do nothing about stuff in built-in libs which is also present in Core.

@cristianoc
Copy link
Collaborator

cristianoc commented Apr 14, 2023

OK so if you look into node_modules/rescript/lib/ocaml, the only one for which we do 2 copies at the moment is pervasives.
Notice that most of the time it just works. So go ahead and use Obj.magic. Just don't write a type annotation for it. Or eta-expand it as in my previous response.

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Old issues that went stale label Sep 13, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Old issues that went stale
Projects
None yet
Development

No branches or pull requests

2 participants