Stream: contributing

Topic: good first zig projects


view this post on Zulip Dana Baguley (Sep 14 2023 at 17:33):

Is the standard library in the main roc repo? I didn't see any issues there tagged as a good first issue that looked relevant to me.

view this post on Zulip Dana Baguley (Sep 14 2023 at 17:35):

found some stuff searching for zig. If I decide to work on something what's the etiquette as far as assignment to me? I've never interacted with an open source project

view this post on Zulip Brian Carroll (Sep 14 2023 at 17:43):

There's a "CONTRIBUTING.md" file with some useful info about that

view this post on Zulip Richard Feldman (Sep 14 2023 at 17:54):

welcome, Dana! :wave:

view this post on Zulip Notification Bot (Sep 14 2023 at 17:54):

4 messages were moved here from #introductions > introductions by Richard Feldman.

view this post on Zulip Richard Feldman (Sep 14 2023 at 17:55):

I moved this to #contributing - so if there's anything that you'd like to work on, feel free to just chat about it here!

view this post on Zulip Dana Baguley (Sep 14 2023 at 17:58):

I'm looking at examples/glue/rust-glue and seeing if I can wrap my head around what a zig version would entail. I assume that's what Brendan mentioned

view this post on Zulip Richard Feldman (Sep 14 2023 at 17:58):

@Dana Baguley I found a couple of beginner-friendly TODOs in Dec.zig, which is our implementation of a 128-bit fixed-point decimal:

https://github.com/roc-lang/roc/blob/85c0eaddcb4190d8062919bb1146479bd914708e/crates/compiler/builtins/bitcode/src/dec.zig#L84

view this post on Zulip Richard Feldman (Sep 14 2023 at 17:59):

basically all of the TODOs that talk about panicking or doing a "runtime exception" should be calling the roc_panic at the top of the file

view this post on Zulip Richard Feldman (Sep 14 2023 at 18:01):

in roc repl (which, once you get roc building from source, you can run with cargo run -- repl) you can reproduce what an overflow panic should look like with:

» (Num.toU32 -1) + 1
This Roc code crashed with: "integer addition overflowed!"

view this post on Zulip Richard Feldman (Sep 14 2023 at 18:01):

basically we want to get to that same thing but it should say "decimal addition overflowed!" or "decimal multiplication overflowed!" etc.

view this post on Zulip Richard Feldman (Sep 14 2023 at 18:02):

actually it looks like we have that one for decimal addition: https://github.com/roc-lang/roc/blob/85c0eaddcb4190d8062919bb1146479bd914708e/crates/compiler/builtins/bitcode/src/dec.zig#L245 - it's just still a TODO for some of the other operations :big_smile:

view this post on Zulip Richard Feldman (Sep 14 2023 at 18:02):

what do you think of that as an introductory project?

view this post on Zulip Dana Baguley (Sep 14 2023 at 18:02):

I'd like to see what I can do with it. :)

view this post on Zulip Richard Feldman (Sep 14 2023 at 18:05):

awesome! Feel free to post here if you have any questions or run into any bumps in the road!

view this post on Zulip Dana Baguley (Sep 14 2023 at 18:05):

I expect I will. :)

view this post on Zulip Dana Baguley (Sep 14 2023 at 23:40):

Probably naive of me, but I had no idea getting the compiler to build would be such an undertaking. Most of that was getting nix to work on a Mac, actually. Tomorrow I'll see if the fix to the code is as easy as it looked at first glance a few hours ago. If so I'll probably take far longer figuring out how I can see my changes affect the code than I will actually making the changes.

view this post on Zulip Richard Feldman (Sep 14 2023 at 23:44):

yeah I wish we could make that easier somehow :thinking:

view this post on Zulip Richard Feldman (Sep 14 2023 at 23:44):

like it would be awesome if we could make git clone followed by cargo test Just Work

view this post on Zulip Richard Feldman (Sep 14 2023 at 23:44):

I think at a minimum we we would need to do something like download LLVM in build.rs for your particular OS and put it somewhere and set LLVM_130_PREFIX to there?

view this post on Zulip Richard Feldman (Sep 14 2023 at 23:45):

I know there are other dependencies besides LLVM that we get from Nix (edit: and zig, but that's a standalone binary we could also download in build.rs and then always invoke using a full path), but I don't remember what they are anymore or why we need them

view this post on Zulip Anton (Sep 15 2023 at 08:40):

I've recently added some comments explaining why a dependency is needed.

view this post on Zulip Anton (Sep 15 2023 at 08:43):

Can you explain what went wrong with getting nix to work @Dana Baguley?
We test the nix setup on both an intel and m1 mac on every change, so I'm really curious.

view this post on Zulip Anton (Sep 15 2023 at 08:45):

I've been wanting to set up a github codespace but haven't gotten around to it yet. That will allow contributors to get started with minimal friction.

view this post on Zulip Dana Baguley (Sep 15 2023 at 14:06):

I'd never used nix before, so the issues were all in setting up nix on an intel mac rather than problems on the roc end of things. The install script makes some bad decisions that I had to google a million sources to figure out. At one point I had to literally replace all the instances of "linux" with "darwin" in some config file or other. I'm going to try to gather up my memories of what all was entailed later today when I'm more awake. Unfortunately there was a lot of frustrated flailing on my part and no note taking, so it'll be spotty.

view this post on Zulip Dana Baguley (Sep 21 2023 at 01:16):

I feel like I should apologize for slow motion on this. I've got a combination of stuff going on and being very good at procrastinating at the front end of new activities.

view this post on Zulip Brendan Hansknecht (Sep 21 2023 at 01:35):

Don't worry the slightest bit. We all have lives and fall into procrastination as well. Roc is fundamentally an open source project with contributors that come and go. Any contributions are wonderful, but delays are normal and no problem at all.

view this post on Zulip Dana Baguley (Sep 21 2023 at 01:49):

I know, but I needed to hear it anyway. :)

view this post on Zulip Dana Baguley (Sep 24 2023 at 01:20):

It looks like fixing this is almost as simple as cut and paste from the decimal addition to the other operations and modifying the messages. I've been looking around, figuring out how I would test it out in the repl, and it has me wondering about the conceptual boundry between the standard library written in zig and the compiler written in rust. It seems like the built-in types are implemented in zig. Maybe if I were looking at the Rust code I'd feel like they were implemented there but I'm drawing the line at reading two languages I don't know for now. :)

view this post on Zulip Brian Carroll (Sep 24 2023 at 06:39):

Yes the standard library is implemented in Roc and Zig.
The compiler just has a list of type signatures to help it connect the Roc and Zig code together properly. But that's not relevant for this work.


Last updated: Jul 06 2025 at 12:14 UTC