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.
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
There's a "CONTRIBUTING.md" file with some useful info about that
welcome, Dana! :wave:
4 messages were moved here from #introductions > introductions by Richard Feldman.
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!
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
@Dana Baguley I found a couple of beginner-friendly TODOs in Dec.zig
, which is our implementation of a 128-bit fixed-point decimal:
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
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!"
basically we want to get to that same thing but it should say "decimal addition overflowed!" or "decimal multiplication overflowed!" etc.
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:
what do you think of that as an introductory project?
I'd like to see what I can do with it. :)
awesome! Feel free to post here if you have any questions or run into any bumps in the road!
I expect I will. :)
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.
yeah I wish we could make that easier somehow :thinking:
like it would be awesome if we could make git clone
followed by cargo test
Just Work
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?
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
I've recently added some comments explaining why a dependency is needed.
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.
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.
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.
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.
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.
I know, but I needed to hear it anyway. :)
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. :)
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