Stream: beginners

Topic: RocGlue - how to debug failing asserts


view this post on Zulip Jared (Jan 26 2024 at 17:16):

I'm playing around with basic-webserver, and running glue-gen.sh results in some syntax errors (which I have a fix for) and some failing assertions (which get commented out in the basic-webserver repo).

view this post on Zulip Jared (Jan 26 2024 at 17:16):

Any tips on how to find out what the size_of those unions actually are, and how to fix the calculations?

view this post on Zulip Jared (Jan 26 2024 at 17:17):

assert_eq!() is apparently invalid to use in a top-level const, so I'm not sure where to go from there

view this post on Zulip Richard Feldman (Jan 26 2024 at 17:17):

@Folkert de Vries knows a trick for that, but I forget what it is

view this post on Zulip Jared (Jan 26 2024 at 17:19):

ah ok, I managed to put an assert_eq in server.rs run_server(), so I at least know what the number should be now

view this post on Zulip Folkert de Vries (Jan 26 2024 at 17:22):

Just assert with == works for some types, numbers mostly

view this post on Zulip Jared (Jan 26 2024 at 17:27):

So assert with == doesn't tell you what the number actually was, if the assertion fails

view this post on Zulip Jared (Jan 26 2024 at 17:38):

ok noob question: is there a way to do a debug log in roc code? RustGlue.roc is huge and I'd like to quickly introspect what's going on in the middle of it.

view this post on Zulip Brendan Hansknecht (Jan 26 2024 at 17:54):

dbg someValue

view this post on Zulip Brendan Hansknecht (Jan 26 2024 at 17:54):

That said, no idea if glue is wired up to support it.

view this post on Zulip Folkert de Vries (Jan 26 2024 at 17:56):

for the assert, you can make a type error by doing something like assert!([0; 42] == [0; YOUR_VALUE])

view this post on Zulip Jared (Jan 26 2024 at 18:06):

oh nice

view this post on Zulip Jared (Jan 26 2024 at 18:07):

hm yeah looks like roc glue doesn't show the dbgs

view this post on Zulip Folkert de Vries (Jan 26 2024 at 18:09):

they should be somewhere, but you may not get to see the stdout of that process

view this post on Zulip Luke Boswell (Jan 26 2024 at 20:05):

It would be really nice to fix this particular issue. That would mean we dont have to keep the glue for basic-webserver and basic-cli checked into the repo but can use the script to generate locally when doing platform dev.

view this post on Zulip Folkert de Vries (Jan 26 2024 at 21:31):

you mean remove/adjust the failing asserts?

view this post on Zulip Luke Boswell (Jan 26 2024 at 21:51):

The glue bugs that generate invalid rust for those platforms.


Last updated: Jul 06 2025 at 12:14 UTC