I'm trying out the new compiler on AoC and my dbg statement has no effect in the terminal.
My code is this:
app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.4/6XA8JLWhmG1FSgb8GxPjBs9cGrtRqopohR3KAHYo722z.tar.zst" }
import pf.Stdout
import pf.Stdin
main! = |_args| {
parsed = parse_input(input)
dbg "dbg"
dbg parsed
Stdout.line!("stdout")
Ok({})
}
parse_input = |_| {
[Left(21), Right(37)]
}
input = "R33\nL22\n..."
Running roc main.roc, this is only printing "stdout", no "dbg" or other stuff...
I want to report this just for the case that it is inadvertently broken. I will manage without it and it's fine if it is not yet implemented. :)
not sure about dbg, but since you are trying the new compiler, beware that there are still bugs that are not easy to circumvent to solve AoC puzzles. Currently, my AoC day 1 solution is still leaking memory, and my day2 is still facing panics or other crashes. There has been a lot of progress in bug fixing but still not there yet.
Yep, I'm aware that the compiler is fresh. Thanks for the heads up! :)
It was working... but I think we may have broken it recently.
If you make a GH Issue that would help track it. Do you know if it's all dbg statements?
I will make a GH issue with all information I have. :)
Oh I think I know what the issue here specifically is...
/// Roc debug function
fn rocDbgFn(roc_dbg: *const builtins.host_abi.RocDbg, env: *anyopaque) callconv(.c) void {
_ = env;
const message = roc_dbg.utf8_bytes[0..roc_dbg.len];
std.log.debug("\x1b[33mRoc dbg:\x1b[0m {s}", .{message});
}
This is from the platform... and we print using std.log.debug
When I built a release of the platform I used -Doptimize=ReleaseSafe so I bet that is a no-op when using that platform from a URL release
That should probably be using stderr instead, and have a global so it exits with a non-zero exit code I think.
So I don't think this is a "bug" in Roc but in my zig platform template.
Yeah so with this test program using the fx test platform
app [main!] { pf: platform "./platform/main.roc" }
import pf.Stdout
import pf.Stdin
main! = || {
parsed = parse_input(input)
dbg "dbg"
dbg parsed
Stdout.line!("stdout")
}
parse_input = |_| {
[Left(21), Right(37)]
}
input = "R33\nL22\n..."
$ roc test/fx/test_app.roc
ROC DBG: "dbg"
ROC DBG: [<tag_union variant=0>, <tag_union variant=1>]
stdout
Thanks! Do you want me to create an issue on your platform repo? (I have created one on the Roc repo which I will close.)
Interestingly though... that <tag_union variant=0> looks like a bug to me, that should print the tag I would assume
GH issue: https://github.com/lukewilliamboswell/roc-platform-template-zig/issues/18
If I can fix my issues with the roc build PR I need to make a new release of the platform anyway as that is a breaking change for the platforms, they now require a "targets" section in the platform header
@Luke Boswell so you know, you can now make a release of roc-platform-template-zig by clicking the "Run workflow" button here.
Thank you Anton, I hadn't noticed that
The above issue is fixed in commit f3bb846a74cbcbf4f80252e85252d0df79effcfb should be in the next release
Last updated: Dec 21 2025 at 12:15 UTC