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

> 1) Abstract data types encourages closed systems. You may view this as a positive: It enables exhaustiveness checks. But I view it as a way to make your program more fragile. Go's type asserts let you convert to interface types, so you can add new interface implementers later and not have to go fix-up old type-assertions.

Is the idea here that all types should be open? Should I be able to e.g. add 1.5 as a possible instance for the Int and String types?

Interfaces should be open, but one also needs the ability to represent closed datatypes.



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: