Stream: beginners

Topic: panic when just adding a new Dict


view this post on Zulip Steve Howell (Mar 15 2026 at 22:34):

See the following commit that causes a panic:

https://github.com/showell/zulip-roc/commit/bb2e53a4eb38b7d857015e934ba8ac8b1266fcc6

view this post on Zulip Steve Howell (Mar 15 2026 at 22:34):

    $ ~/roc/roc database.roc
    thread 'main' panicked at crates/compiler/gen_llvm/src/llvm/build.rs:5582:19:
    Error in alias analysis: error in module ModName("UserApp"), function definition FuncName("\x0f\x00\x00\x00\x1f\x00\x00\x006\xb7\xa8\xd7\x8cT\xc2\x99"), definition of value binding ValueId(11): could not find func in module ModName("UserApp") with name FuncName("\t\x00\x00\x00\x7f\x00\x00\x00\xa1\x891\xed\xc6\xf9\x823")
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

    $ ~/roc/roc version
    roc nightly pre-release, built from commit d73ea109 on Tue 09 Sep 2025 09:02:08 AM UTC

view this post on Zulip Steve Howell (Mar 15 2026 at 22:36):

Is the 9/9/2025 build the most stable build on the old compiler? This isn't the first panic that I have encountered while doing fairly simple things.

view this post on Zulip Steve Howell (Mar 15 2026 at 22:37):

I'm running Ubuntu through WSL on Windows. I installed Roc by following the link from the tutorial.

view this post on Zulip Steve Howell (Mar 15 2026 at 22:46):

I started getting the panic when I added a dictionary called "user_map" with type of "User" to a "Database" type that already had three very similar maps and was passing tests.

view this post on Zulip Steve Howell (Mar 17 2026 at 11:33):

I'm kinda stuck here. Is there anybody that can help diagnose why the panic is happening for the relatively simple project that I have? It's under 300 lines of code, and I am basically just manipulating Dicts using small test programs.

view this post on Zulip Steve Howell (Mar 17 2026 at 11:34):

To be clear, the final commit "causes" the panic for some reason. If you revert that commit, the code compiles and does what I expect.

view this post on Zulip Steve Howell (Mar 17 2026 at 11:36):

--- a/Database.roc
+++ b/Database.roc
@@ -1,11 +1,12 @@
 module [Database, new, insert_channel, insert_message, set_topic]

-import DbTypes exposing [ID, Channel, Message, Topic]
+import DbTypes exposing [ID, Channel, Message, Topic, User]

 Database : {
     channel_map : Dict ID Channel,
     message_map : Dict ID Message,
     topic_map : Dict ID Topic,
+    user_map : Dict ID User,
 }

 new : Database
@@ -13,6 +14,7 @@ new = {
     channel_map: Dict.empty({}),
     message_map: Dict.empty({}),
     topic_map: Dict.empty({}),
+    user_map: Dict.empty({}),
 }

 insert_channel : Database, Channel -> Database
diff --git a/DbTypes.roc b/DbTypes.roc
index 19a3856..24ec39a 100644
--- a/DbTypes.roc
+++ b/DbTypes.roc
@@ -1,4 +1,4 @@
-module [ID, Channel, Message, Topic]
+module [ID, Channel, Message, Topic, User]

 ID : U32

@@ -20,3 +20,8 @@ Topic : {
     channel_id : ID,
     topic_name : Str,
 }
+
+User: {
+    user_id: ID,
+    full_name: Str,
+}

view this post on Zulip Steve Howell (Mar 18 2026 at 12:12):

One thing that is oddly coincidental is that the panic message says "error in module ModName("UserApp")", and I am doing stuff with my own "User" object. But that seems like it has to just be a coincidence. I don't have enough Rust expertise or compiler expertise to really dig into this, so I am kinda stuck.

view this post on Zulip Anton (Mar 20 2026 at 08:58):

One thing that is oddly coincidental is that the panic message says "error in module ModName("UserApp")", and I am doing stuff with my own "User" object. But that seems like it has to just be a coincidence.

Yes that is indeed a coincidence, UserApp is an internal name we use.

Putting everything that is in DbTypes in Database.roc could be a possible workaround. I am afraid I can't prioritize issue with the old compiler. One reason for the zig re-write is that the old compiler was too buggy, even for small projects.

view this post on Zulip Anton (Mar 20 2026 at 09:02):

Is the 9/9/2025 build the most stable build on the old compiler?

This is indeed the most stable build.

view this post on Zulip Steve Howell (Mar 20 2026 at 12:51):

Ok, thanks for responding. I'm probably just going to wait for the zig re-write before continuing with Roc. Apart from the obvious frustrations related to the compiler panics, it was fun getting to "think in Roc" again. (I had never used Roc, but for the basic stuff I was doing, it reminded me of Elm days. It takes a couple hours to get back into the mindset, but then it just kinda clicks.)

view this post on Zulip Richard Feldman (Mar 20 2026 at 14:28):

yeah sorry about that...we're getting very close to being out of this annoying "limbo" state where we have 2 compilers but can't really recommend either of them for different reasons :sweat_smile:

I'll try to run the new compiler on this zulip-roc repo once we get the currently-known bugs resolved and make sure it works before I ping you to try it again!

view this post on Zulip Steve Howell (Mar 20 2026 at 17:01):

Sounds good! I look forward to it. I'm learning Odin in the mean time. That's a fun language too, and I was partly inspired to learn it from one of Richard's podcasts, I am pretty sure. (I have kind of lost track of how I went down various rabbit holes learning about Roc.)

view this post on Zulip Norbert Hajagos (Mar 20 2026 at 20:10):

@Steve Howell
I've also read like 60% of the Odin lang overview, just to get the idea of what the language is about. It was a super interesting experience, since I've written some Go before, but not enough to form an informed opinion on most of its design decisions. It surprised me how similar they are. The second time I saw the same ideas / features that I've consider odd, like making the zero values useful, multiple return values, tagging struct fields, runtime type information (on a systems lang), the default map implementation being baked in to the language with special syntax, it really made me think that these features were also essential to Go and were't accidental. Some features fall off of others and I thought maybe that was the case with go. But Bill has followed these ideas in his own language, so they are worth thinking about on their own.

I highly recommend his blog btw, the 2 article on the billion dollar mistake is superb!

view this post on Zulip Steve Howell (Mar 21 2026 at 02:07):

Having the maps baked into Odin with the syntax sugar definitely reduces the learning curve. By far the biggest thing that has helped me ramp up (~500 lines so far) is the excellent testing system: https://odin-lang.org/docs/testing/

I will check out the blog too!

view this post on Zulip Norbert Hajagos (Mar 21 2026 at 10:52):

And I'll check out the testing :)


Last updated: Apr 10 2026 at 12:38 UTC