8 Comments
Comments from the original post on X (Twitter)

@DuskyDaily
Honestly your tagged unions with `.as` thingy is not "verbose"... it does exactly what it's suppose to do and one can clearly see it
15 likes

@AnshumanKhanna5
I didn't know this "as" naming and it's genuinely interesting but I would replace "tag" with "type" or "is"
4 likes

@Wasi_______
With C11's unnamed unions, you don't have to name the union anything, is a bit nicer than
3 likes

@tsoding
Tracks: - -
3 likes

@giacomomasseron
does the switch warn you when you miss a variant or does it silently fall through
1 like

@TutaNeraType
Clever

@CaptAmericaTx
Tagged unions in C are fine to use. I developed a framework just for that purpose. The framework is just a one liner script "alias gcc=g++" . Once installed, the tags can be specified using the "class" feature of my framework. Framework tokens billed per 100 lines of C code.

@ExpertOfNil
Trying to make a language fit a different mold usually results in pain when things get complicated... in my experience.