When updating the tests for the snake_case change, it was really easy to miss a lot of syntax issues because everything was in a string. We might consider moving as many tests into snapshots as possible at some point, but for now, we can still make catching these issues easy by giving warnings for old syntax, including:
\args ->
syntax once we move to |args|
syntaxAnyone disagree? Otherwise I can do this, probably no issue needed.
"my string ${interpolation}"
too
I keep forgetting that one, good catch
The other one mentioned in the Richard's draft blog about functional PI is the ??
I'm not sure we're tracking any Issues for that
They're mentioned here: https://github.com/roc-lang/roc/issues/7086
Nvm.. I just realised it's already implemented. :sweat_smile:
main! = \_args ->
value = Env.var!("NAME") ?? "LUKE"
Stdout.line!("Hello, $(value)!")
Anthony is a Bull in an Unimplemented Syntax Shop
What did I do now?
Oh ??
Yeah I did that
I’m dragging Roc into the future
Luckily not kicking and screaming. That my four year olds job
Can tags have single underscores in them?
Normal tags are PascalCase
But I've been seeing some SCREAMING_SNAKE_CASE tags recently
Though I'm only seeing a single word for these
Where have you seen that?
GET, POST, DELETE, etc.
We had a conversation about those specifically, Richard wanted them UPPERCASE
But what should we do if it's two words
TWOWORDS or TWO_WORDS?
We could allow either SCREAMING_SNAKE_CASE or PascalCase, but you can only have either underscores or lowercase letters
I like SCREAMING_CASE for constants, so for tag unions without payloads it kind of feels ok
Maybe tag unions with payloads are only PascalCase? (just spitballing here)
I don't think we want to be too restrictive. Maybe just allow anything as long as it starts with an Uppercase ASCII letter?
For context, I'm trying to write a utility that parses out relevant info for names in one O(n) pass, e.g.
This will help with reporting non-snake_case names, in addition to other stuff
We definitely want to allow running any code even if we don't like it
But I think Roc being opinionated on style makes code more consistent in unfamiliar codebases, which is a really nice feature
I don't think we should allow more than one underscore in a row, for example
yeah I agree about disallowing (via warning) multiple underscores in a row
Should we allow First_Second
?
I think no
I think that's ok. I could imagine a scenario where you're trying to make a tag for each field in a record or something
and there might be underscores in there, and you want them to match up
fair
We might consider moving as many tests into snapshots as possible at some point
I'm not a fan of that, I think it's difficult for newcomers to find the snapshot file for a specific test. It requires more effort to see the input for a test for experienced people too.
Okay, makes sense. I think the thing I was thinking of was that we should make it easy to update tests with Roc changes, but that should happen if we make add warnings for invalid Roc
Last updated: Jul 06 2025 at 12:14 UTC