Hi there. Would it be possible that the language will allow snake case in tag unions? Let's compare some examples to see why it is more readable:
# Compare this
Foo : [
HTTP_Request
HTTP_Response
]
# with:
Foo : [
HTTPRequest
HTTPResponse
]
It is of course possible to write HttpRequest, but acronyms should all be capitalized.
On a side note. The compiler error message could be improved in the hint:
I am partway through parsing a tag union type, but I got stuck here:
3│ Foo : [
4│ HTTP_Request
^
I was expecting to see a tag name.
Hint: Tag names start with an uppercase letter, like Err or Green.
The hint could be Hint: Tag names do not allow underscores
Personally, I haven't had any problems with reading acronyms like Http and I think most people don't have a problem with it because a similar argument applies to lower snake_case, e.g. the acronym HTTP isn't capitalised in the variable name http_request, but many languages like Python have names like that.
I'm interested why you think HTTP should be capitalised in a tag, is it for correctness or for readability?
Edit: Just re-read the first sentence and you mention it is for readability
I'm tempted to agree with you, but since you bring in lower snake case and other languages then a function with this name map_R_to_TS reads much more fluently to me than mapRToTs. It quickly shows up when you have one letter acronyms.
I guess my solution to that is to spell out acronyms :sweat_smile: Obviously you can't do that for every acronym like HTTP, but I'd rarely use a one letter acronym
Hannes said:
I guess my solution to that is to spell out acronyms :sweat_smile: Obviously you can't do that for every acronym like HTTP, but I'd rarely use a one letter acronym
Haha, what about things that are named with one letter, like _R_ the programming language?
it reminds me window.atob of web api. Like, it's supposed to be aToB (which in it's turn is asciiToBinary) but nobody is crazy enough to follow camelCase to the letter :grinning_face_with_smiling_eyes:
Jamie Neubert Pedersen said:
what about things that are named with one letter, like _R_ the programming language?
Technically R isn't an acronym because it doesn't stand for anything, so I'd just write R :sweat_smile:
I definitely think this is a case where the language style pushes users to treat an entire acronym as a single word at least in terms of capitalization.
Personally, I think we should keep it consistent. I also am a tad biased cause that matches the style guides of most c++ code bases I have worked in (despite c++ allowing more flexibility).
I get that there is no guarantee around capitalization, but I think the less options here, the more likely errors across the library ecosystem will feel consistent.
@Hannes, yeah it's not an acronym. Case in point with my above function definition map_R_to_TS vs mapRToTs :smiley:.
@Brendan Hansknecht I am totally for consistency, but maybe I just disagree a bit on what should be the convention then :wink:. I have also been looking at code bases in different languages and I've just come to appreciate the readability of snake case even though it's one more character to type. Isn't it also a convention in C++ to have constants named in screaming snake case? MY_CONSTANT?
C++ conventions are by codebase. They also tend to have a lot of minor distinctions. Like most modern conventions are MY_MACRO and kMyConstant...but that's beside the point. (Note the macro might also just be a constant)
Aa for convention. I am now used to roc. And seeing things like HttpMsg or other acronyms with lowercase letters. Not really against or for either convention. Just think that if we expand/switch we should try to really promote/enforce one convention.
Last updated: Jun 16 2026 at 16:19 UTC