Hacker News new | past | comments | ask | show | jobs | submit login

Why would you think struct and interface should be treated the same? To me the fact a struct can implement multiple interfaces means they are not on the same "layer" of abstraction.



Imagine a struct with functions that don't have an implementation: that's an interface.

If it has some implementations and some without, it's an interface with default implementations.

See how Kotlin does it, it's really nice and consistent, and you never need to agonize over the decision of picking a class or a struct.




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

Search: