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

Fatal error: exception File "bytecomp/translcore.ml", line 1167, characters 12-18: Assertion failed #22

Open
yallop opened this issue Nov 5, 2022 · 2 comments

Comments

@yallop
Copy link
Member

yallop commented Nov 5, 2022

a.ml:

macro m = << print_endline >>

b.ml:

macro m () = $(~A.m)

bug:

$ ocamlc a.ml b.ml 
Fatal error: exception File "bytecomp/translcore.ml", line 1167, characters 12-18: Assertion failed
@OlivierNicole
Copy link
Collaborator

This should yield a phase error during the typing phase. A toplevel splice in a macro implies more than two execution phases (~A.m is of phase 2) whereas currently we only support two phases (0 and 1).

While having more than two phases makes conceptual sense, there would be a complexity cost in supporting it (an unknown number of top-level splice execution and replacement stages, instead of just one).

@xnning
Copy link

xnning commented Nov 7, 2022

I'm inclined to think about that as we have two phases (compile-time and runtime) but multiple levels. Perhaps it wouldn't be right to think about that as a phase 2 computation anyway, as it is not necessarily evaluated before all 1 phase programs.

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

No branches or pull requests

3 participants