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

It's interesting that there are no classes, and that there are only Objects, where you just mix everything in.

As I understand it, javascript objects are like this, except you only add in methods one at a time, instead of mixing in and out modules.

It doesn't look like there are inheritance trees. I'm not sure what you'd do to prevent namespace clashes when mixing in different modules or if/how modules share and work on object attribute data, but so far in Ruby, that hasn't been too much of a problem.




I think you'll have a "well, duh" reaction if you implement an OO system in pure C. It is basically just a bunch of structs (data) with a bunch of functions which take a struct pointer as their first argument. Mixins just let you randomly add or remove these functions without any extra shenanigans, which you can also easily do in our pure C OO system.



"I'm not sure what you'd do to prevent namespace clashes when mixing in different modules or if/how modules share and work on object attribute data"

Read the traits paper: http://www.iam.unibe.ch/~scg/Research/Traits/




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

Search: