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

You can only inherit from one class in ruby. You can mixin multiple modules into a class. So they aren't entirely equivalent.


Under the hood, mixing in modules actually is inheritance. An anonymous class is created that has all the module's methods, and this class is added to the inheritance hierarchy.

They are quite literally identical, even if Ruby tries it's best to hide that fact.




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

Search: