Stream: beginners

Topic: Trying roc (new version)


view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 10:58):

I’m giving a try (pun intended) at the new roc and I hope you don’t mind me reporting the issues I face here.

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 10:59):

main! = || {
    zeroU8 = 0u8
    # Stdout.line!("zero: ${zeroU8}")
    Stdout.line!("zero: ${0}")
}

This gives me the following error if I uncomment the line above:

Roc crashed: Error evaluating from shared memory: NotImplemented
error: Failed to run with POSIX fd inheritance: error.ProcessExitedWithError

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 10:59):

I’m on macos, M3

view this post on Zulip Luke Boswell (Nov 25 2025 at 10:59):

The u8 suffix is no longer roc syntax I believe

view this post on Zulip Anton (Nov 25 2025 at 11:00):

Can you make a github issue @Matthieu Pizenberg?

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 11:00):

same crash without the u8

view this post on Zulip Luke Boswell (Nov 25 2025 at 11:01):

I've just "fixed" the crash error reporting on my branch, so it would surface the underlying issue in this case I think

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 11:02):

ok I might wait for your fix branch merge then before making the issue.

view this post on Zulip Luke Boswell (Nov 25 2025 at 11:02):

This is the problem report that should be printed for you

-- UNUSED VARIABLE -------------------------------

Variable zeroU8 is not used anywhere in your code.

If you don't need this variable, prefix it with an underscore like _zeroU8 to suppress this warning.
The unused variable is declared here:
  ┌─ /Users/luke/Documents/GitHub/roc/test/fx/test_u8.roc:4:5
  │
4 │     zeroU8 = 0u8
  │     ^^^^^^

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 11:02):

oh

view this post on Zulip Luke Boswell (Nov 25 2025 at 11:03):

roc check path/to/code is using the more mature BuildEnv setup and reports errors correctly

view this post on Zulip Luke Boswell (Nov 25 2025 at 11:03):

currently the run path e.g. roc path/to/app.roc uses a different path and doesn't print problems

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 11:04):

Luke Boswell said:

roc check path/to/code is using the more mature BuildEnv setup and reports errors correctly

for me roc check ... says the file is fine. (I’ve removed the u8 suffix) yet it crashes

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 11:05):

Luke Boswell said:

This is the problem report that should be printed for you

-- UNUSED VARIABLE -------------------------------

Variable zeroU8 is not used anywhere in your code.

If you don't need this variable, prefix it with an underscore like _zeroU8 to suppress this warning.
The unused variable is declared here:
  ┌─ /Users/luke/Documents/GitHub/roc/test/fx/test_u8.roc:4:5
  │
4 │     zeroU8 = 0u8
  │     ^^^^^^

I  think you forgot to uncomment the line to get this warning.

view this post on Zulip Anton (Nov 25 2025 at 11:08):

Can you add a test for this issue to your new branch @Luke Boswell?

view this post on Zulip Luke Boswell (Nov 25 2025 at 11:09):

Kind of... I haven't really fixed it completely yet

view this post on Zulip Luke Boswell (Nov 25 2025 at 11:09):

I was talking with Richard about this issue earlier today

view this post on Zulip Luke Boswell (Nov 25 2025 at 11:11):

He has a refactor in progress for ModuleEnv to pull out the gpa which is somewhat related. I'm trying to implement a fix, but it's been a bit of a slog through lots of different issues -- and I'm not sure how close to the end I am rn

view this post on Zulip Luke Boswell (Nov 25 2025 at 11:13):

Thank you for sharing this @Matthieu Pizenberg

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 11:14):

Made an issue: https://github.com/roc-lang/roc/issues/8433

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 12:49):

Am I using the when syntax wrong here?

u4_to_hex : U8 -> String
u4_to_hex = |n| {
    when n is
      0 -> "0"
      _ -> "0"
}

because I’m getting the following error:

-- PARSE ERROR -----------------------------------

A parsing error occurred: expr_arrow_expects_ident
This is an unexpected parsing error. Please check your syntax.

   ┌─ /Users/piz/git/roc-lang/roc/test/fx/hex.roc:16:12
   │
16 │       0 -> "0"
   │            ^

-- UNEXPECTED TOKEN IN EXPRESSION ----------------

The token 0 is not expected in an expression.
Expressions can be identifiers, literals, function calls, or operators.

   ┌─ /Users/piz/git/roc-lang/roc/test/fx/hex.roc:16:13
   │
16 │       0 -> "0"
   │             ^
...

view this post on Zulip Anton (Nov 25 2025 at 12:54):

It's called match now:

match is_ready {
    True => "ready to go!"
    False => "not ready yet"
}

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 12:55):

ah ok. I suppose the tutorial page is not up to date. What is a good place to have an overview of the syntax of current roc?

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 12:59):

Nice, ok this one passes the roc check but it gets me the same crash than the one with string interpolation. Should I add it to the same github issue?

main! = || {
    zero : U8
    zero = 0
    zero_hex = u4_to_hex(zero)
}

u4_to_hex : U8 -> String
u4_to_hex = |n| {
    match n {
        0 => "0"
        _ => "0"
    }
}

view this post on Zulip Anton (Nov 25 2025 at 12:59):

We will try to update the tutorial before AoC starts. There is not a good place right now, as a temporary solution you can search through the folder test/snapshots. I will make an updated version of https://github.com/roc-lang/examples/blob/main/examples/AllSyntax/main.roc , that should come in handy.

view this post on Zulip Anton (Nov 25 2025 at 12:59):

Should I add it to the same github issue?

Sounds good

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 13:04):

I also got a panic in the compiler that I also added to the issue.

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 16:56):

I just updated my main, and tried to zig build test again after the fixes by @Richard Feldman in #8434 and now the tests are failing.

❯ zig build test
test
└─ tests_summary
   └─ run test fx_platform_test 7/8 passed, 1 failed
error: 'fx_platform_test.test.fx platform match with wildcard' failed: Run failed with exit code 1
STDOUT:
STDERR:
Roc crashed: Error evaluating from shared memory: NotImplemented
error: Failed to run with POSIX fd inheritance: error.ProcessExitedWithError

/Users/piz/git/roc-lang/roc/src/cli/test/fx_platform_test.zig:291:17: 0x104496f53 in test.fx platform match with wildcard (fx_platform_test)
                return error.RunFailed;

view this post on Zulip Anton (Nov 25 2025 at 17:13):

What OS are you on?

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 17:15):

osx 15.7.2

view this post on Zulip Anton (Nov 25 2025 at 17:54):

I could not reproduce this on macOS 26.1 with commit df660109487f6c7d96709413e9f34d6fbb862c89 on an M2 CPU. Did you make any changes in the folder (git status)?

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 17:58):

I’m on the same commit, status completely clean. M3 cpu. MacOS Sequoia 15.7.2 (24G325)

view this post on Zulip Anton (Nov 25 2025 at 17:59):

Interesting...

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 17:59):

I’m using zig 0.15.2 from brew

view this post on Zulip Anton (Nov 25 2025 at 18:00):

I downloaded zig directly from https://ziglang.org/download/

view this post on Zulip Anton (Nov 25 2025 at 18:01):

I'll try the brew version

view this post on Zulip Anton (Nov 25 2025 at 18:04):

Can you try again after running git clean -fdx? It's possible some artifacts from earlier runs altered things, that would not show up with git status.

view this post on Zulip Anton (Nov 25 2025 at 18:06):

Anton said:

I'll try the brew version

That did not make a difference.

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 18:14):

I tried with the direct download executable did not change anything. However, after the git clean -fdx it worked! So I guess it kept in some local caches even though I had cleaned the folder, and removed the global user cache of zig

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 18:14):

Thanks!

view this post on Zulip Matthieu Pizenberg (Nov 25 2025 at 21:00):

I’m getting the following runtime error:

Roc crashed: Num.U8 does not implement shift_right_by

Do you know where I need too look for the bitwise shift functions? Is it something in the stdlib or a platform thing?

view this post on Zulip Richard Feldman (Nov 25 2025 at 21:35):

@Matthieu Pizenberg we haven't added it yet (we are missing a TON of builtins in the new compiler!) - the full list of them is now in a single file: Builtin.roc

if you want to add those, check out #contributing > Compiler task @ 💬 as an example of how to do it

view this post on Zulip Luke Boswell (Nov 25 2025 at 21:58):

Are the files in src/builtins/roc still used?

view this post on Zulip Richard Feldman (Nov 25 2025 at 22:05):

no, we should delete them

view this post on Zulip Matthieu Pizenberg (Nov 26 2025 at 09:49):

I tried to implement the shifts, but since I don’t know zig, I asked some help from Claude. Unfortunately I’m not managing to have something that runs. I’m getting a panic when I run roc test/fx/shift.roc in my shift branch. If you want to have a look, but I don’t have more time this week I think to try and fix it.

view this post on Zulip Anton (Nov 26 2025 at 10:11):

Thanks for getting started @Matthieu Pizenberg, we'll take care of it :)

view this post on Zulip Matthieu Pizenberg (Nov 26 2025 at 15:01):

I’m a bit too stubborn and tried something else, but I fear something different is actually at play here, in addition to my struggles. When I try the following main:

main! = || {
    one : U8
    one = 1
    two : U8
    two = one.plus(one) # one + one
    Stdout.line!("two: ${two}")
}

I get an error, though if I write one + one it works as expected. So maybe there is something wrong with the static dispatch itself on numeric types.

Roc crashed: Error evaluating from shared memory: NotNumeric
error: Failed to run with POSIX fd inheritance: error.ProcessExitedWithError

view this post on Zulip Anton (Nov 26 2025 at 18:30):

Interesting :thinking:

view this post on Zulip Richard Feldman (Nov 27 2025 at 00:57):

looking into it!

view this post on Zulip Richard Feldman (Nov 27 2025 at 01:13):

@Matthieu Pizenberg for a quick fix, it should be:

Stdout.line!("two: ${two.to_str()}")

view this post on Zulip Richard Feldman (Nov 27 2025 at 01:14):

but there are several compiler things that need to be fixed there:

view this post on Zulip Matthieu Pizenberg (Nov 27 2025 at 01:16):

the stdout doesn’t help. I get the same error with just this:

main! = || {
    one = 1u16
    two : U8
    two = one.plus(one) # one + one
}

view this post on Zulip Luke Boswell (Nov 27 2025 at 01:16):

I believe the 1u16 isn't valid syntax any longer

view this post on Zulip Richard Feldman (Nov 27 2025 at 01:17):

yeah the parser supports it but it isn't wired up to anything and we have a better replacement coming

view this post on Zulip Richard Feldman (Nov 27 2025 at 01:18):

I haven't taken it out of the parser yet because some tests are still using it and we don't have the replacement yet :sweat_smile:

view this post on Zulip Richard Feldman (Nov 27 2025 at 01:18):

but you should get a different error for that, namely that it's missing an expression at the end

view this post on Zulip Matthieu Pizenberg (Nov 27 2025 at 01:18):

Same error with that one too:

main! = || {
    one : U8
    one = 1
    two : U8
    two = one.plus(one) # one + one
    Stdout.line!("two")
}

view this post on Zulip Richard Feldman (Nov 27 2025 at 01:19):

cool, I'll look into that too!

view this post on Zulip Richard Feldman (Nov 27 2025 at 01:19):

thanks for all the investigation btw :smile:

view this post on Zulip Matthieu Pizenberg (Nov 27 2025 at 01:20):

I reeeaaally wanted to try it ahah

view this post on Zulip Matthieu Pizenberg (Nov 27 2025 at 01:20):

got excited after the last recording XD

view this post on Zulip Richard Feldman (Nov 27 2025 at 05:05):

@Matthieu Pizenberg https://github.com/roc-lang/roc/pull/8466 should fix this!


Last updated: Nov 28 2025 at 12:16 UTC