mastodon.gamedev.place is one of the many independent Mastodon servers you can use to participate in the fediverse.
Mastodon server focused on game development and related topics.

Server stats:

5.3K
active users

Lately my Zig code has started to look like this in all my projects

ziglang.org/devlog/2024/#2024-

Joseph Humfrey

@andrewrk Yeah I’ve done the same with enums in C#, it works great! Though it feeeeels slightly hacky?

I think some languages have that as keyword, a bit like a type alias but not allowing it to be interchangeable with the original. Maybe “distinct”? (I’m sure you know about this as a thing much better than me!)

@joethephish I understand the appeal to such a thing, however, the flexibility of having it also be a namespace is extremely useful, as you can see from the two examples at the end

@andrewrk @joethephish. I also use this technique constantly. It's similar to how I'll wrap a C library's pointers in my own namespaces. Feels like what I'd actually want is a "namespaced primitive", so the value automatically coerces to u32 without needing an `enumToInt` but can also have a namespace + functions, etc.