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

It is no different than using interfaces, protocols, pure virtual base classes....


It's similar, but there are some differences. Notably, my package can implement my trait for your type, while my package (usually? always?) cannot make your type inherit from my virtual base class.


Depends on the flexibitly of the language, there isn't a golden way to do that across all variations of OOP.


Wrapper classes should be equally good once Valhalla (jdk) lands, without introducing another pointer indirection.


Interesting but Java gets more and more complex in a way that does not make me want to write things in Java.




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: