Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My bad. I was not aware on incredibly limited go generics are. I tried to make it work despite all restrictions but gave up here https://go.dev/play/p/XVTuJ--ZLgS


I'm not well versed in golang generics (at $WORK we use go, but not generics yet) but if you want type switches you'll need interface{} to do that https://go.dev/play/p/1Tn2O_7vCTQ

Which of course defeats the point of using generics

_edit: clarify that my attempt is a bad practice_




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: