Closed DZakh closed 2 months ago
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.
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.
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.
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 theuncurried: true
doesn't propagate to the built-in stdlibs.