An idea I’ve been thinking about is using blocks as Roc’s conventional syntax for precedence grouping.
Gleam was the first language I used that does this. At first it felt strange, coming from languages like C++, but it clicked once I started thinking of precedence grouping as a block containing a single expression. Instead of having one syntax for precedence grouping and another for blocks, Gleam consolidates both ideas into the same syntax.
The same thing already works in Roc (though the formatter really doesn't like to keep it on a single line):
dbg { 3 - 2 } * 3
dbg (3 - 2) * 3
Both produce:
[ROC DBG] 3.0
[ROC DBG] 3.0
Curious if this is something that has been discussed at all before / what the team's stance on blocks for precedence might be.
Interesting. It does look a bit weird at first. What are the main benefits?
The honest answer is that it doesn’t do anything that parentheses can’t already do for simple expressions. For me, it just feels like a small refinement to the status quo.
If a language supports blocks that evaluate to the value of their final expression, then it already has a construct for grouping expressions to be evaluated together before the surrounding expression. To me, that makes parentheses feel redundant for precedence grouping.
That being said, I totally understand how much history parentheses have, and maybe the small consistency benefit of consolidating both ideas under one construct isn’t worth the friction of asking users to move away from such a long-standing convention.
yeah I think the "consistency over familiarity" of that fits Gleam better than Roc :smile:
(see also Roc having if and Gleam not having it because case already covers conditional branching)
Last updated: Aug 12 2026 at 12:35 UTC