I ran into something a bit confusing today:
100 // 10 * 10
gives
1 : Int *
but
100 / 10 * 10
gives
100 : Frac *
I would have expected the first expression to give the same result as the second. Am I missing something here?
Most likely the // operator have a lower priority than / and * which have the same priority I guess.
Definitely a bug
//, /, and * should all have the same priority.
Is this in the rust or the zig version of the compiler?
I am on roc nightly pre-release, built from commit d73ea109cc2 on Tue Sep 9 10:23:53 UTC 2025.
Ok. So that is in then old rust compiler I think.
Oh, interesting, in the rust compiler, double slash (integer division) and percent (modulo) are intentionally lower precedence. I still vote that it is a bug though. https://github.com/roc-lang/roc/blob/9243fcdebb0341577201a58e7a5e9c666f4ce2cb/crates/compiler/module/src/called_via.rs#L10-L11
Not sure the state in the zig compiler.
@Richard Feldman, these should all be the same precedence, right? I think that is what is expected from most languages.
Last updated: Nov 28 2025 at 12:16 UTC