Hi folks!
After going through the Roc tutorial for the new compiler, I was confused about the [].{} syntax and the difference between :: and :=. I now understand that it's type def syntax and :: is for opaque types. I feel like the tutorial should cover this, at least in passing, because it's hard to search for information about it when you don't know what it is. It's not like you can search for "opaque" if you don't know what :: is, and searching for "::" or ":=" is tricky.
That said, it might be a sign that the syntax should be more beginner-friendly. For example:
Color := opaque type [...].{...}
Note: this is just a random syntax example to get my point across, not a suggestion for an actual syntax.
yeah, for sure! I need to do a thorough revamp of the tutorial once the new compiler is fully operational :smile:
The :: and := and [].{} syntax is definitely the scariest part of Roc's syntax to me. Perhaps it's ok if it's not needed too often.
I agree; coming from the outside, it doesn't "read well". It reminds me of Nix in that way. My sense is that the "purity of expression" requires that we chew through a little bit of bread to get to the meat of the sandwich. It would probably be very helpful to explain what the bread is and why it's there.
I agree, I would also prefer adding opaque somewhere and using := instead of ::.
I'm open to revisiting this syntax design but it's a big design can of worms I don't want to open right now. At the moment I want to focus on getting the new compiler usable to the point where it can be announced :smile:
Anton has marked this topic as resolved.
Last updated: Jun 16 2026 at 16:19 UTC