Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
ewuhic
on Sept 22, 2023
|
parent
|
context
|
favorite
| on:
Using enums to represent state in Rust
What would be the equivalent of these patterns in Go?
fsdjkflsjfsoij
on Sept 22, 2023
[–]
You can't do the exact same thing in Go because Go doesn't have a way to define a sum type yet outside of generic constraints. The closest you can get is using an interface and a type switch but that won't give you exhaustive matching.
Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: