this post was submitted on 11 May 2026
61 points (98.4% liked)
Programming
26901 readers
302 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Rust doesn't need this as much because it has enums so you can just do
create_user(user, Role::Admin, Notify::None).you can have a better data structure in any language, but rarely someone will bother doing that for booleans
Yeah I do wonder if we need an easier way to declare these things because programmers are lazy and even in Rust I wouldn't always bother.
You can kind of do it in Typescript with strings:
But of course the downside is they are strings at runtime. I'm sure it's possible though.
Right cause the boolean isn't a named type. If you have two possible states that can be represented with a boolean, or an enum of the two possible states which embeds more info into the callsite