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

Ruby 2.0 was (and hopefully still) earmarked to have traits which are an enhancement on mixins providing a much better & refined compositional implementation.

Thus it (should) allow you to do things like excluding or renaming methods/traits ala Perl roles - https://metacpan.org/module/Moose::Manual::Roles#METHOD-EXCL...



Refinements will be at the 2.0 release but I wouldn't call that feature "multiple inheritance".


Neither would I because refinements are something completely different to traits!

Refinements proposed in Ruby 2.0 allows you to localise monkey-patching much like you can do in Perl with dynamic scoping (for e.g.: http://news.ycombinator.com/item?id=1603321 | http://news.ycombinator.com/item?id=3455507). For further info on Ruby refinements see here: http://timelessrepo.com/refinements-in-ruby

Traits are an improvement to mixins. IIRC Matz gave a talk (RubyConf 2010?) where he describes the proposed traits implementation. Here's one set of slides (not Matz's talk) which also shows some traits examples - http://www.slideshare.net/fabiokung/ruby-20-to-infinity-and-...




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

Search: