Hey ya'll, just coming back to roc after being a way for a while. So much progress on the new compiler... I can't believe how far it has come! Congrats on all the amazing progress! :partying_face:
Just found a bug with the new List.map implementation. It seems that calling List.map on an empty list causes a runtime crash:
Roc crashed: Internal error: TypeMismatch in for_iterate continuation
Min repro:
app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.6/2BfGn4M9uWJNhDVeMghGeXNVDFijMfPsmmVeo6M4QjKX.tar.zst" }
main! = |_args| {
l = List.map([], |_| 0)
dbg l
Ok({})
}
Roc version:
Roc compiler version release-fast-4b857fa1
hey @Ian McLerran! Great to see you! :smiley:
would you mind opening a gh issue for it?
Good to be back! :smiley: I absolutely can do!
Issue at #8722
Just for my own edification and understanding of the current compiler design, I see that the TypeMismatch error is being thrown by for_iterate. From what I can see, for_iterate only exists in interpreter.zig. However this issue obviously(?) occured in compiled code.
I had assumed that the interpreter is not invoked for compiled roc code, but I believe I may have had a wrong understanding of the new compiler architecture (admittedly my understanding is only slightly above nil).
Can anyone clarify for me why I am seeing code from interpreter.zig appearing to crash in compiled(?) roc code?
We only have an interpreter... there is no lowering to machine code or llvm yet
When you do roc build we using an interpreter shim to link with the platform host (the platform author doesn't need to change a thing - the ABI is the same).
Once we have a llvm backend we can use that optimised machine code instead of the shim.
For running roc in a dev loop, i.e. roc path/to/app.roc the design is to always ise an interpreter for really fast startup time.
Though it is currently a bit of an experiment as to whether an interpreter will provide a sufficiently fast enough runtime performancs. The alternative would be to reinstate our dev backends but that re-introduces (slow) linking into the workflow.
actually we don't have to reintroduce linking into the dev workflow - we can use the same "prebuilt host shim" strategy we do for the interpreter, just have it execute the compiled bytes instead of running an interpreter :smile:
Ian McLerran said:
Issue at #8722
Will be fixed in #8725
Last updated: Jan 12 2026 at 12:19 UTC