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

Well, isn't the use case for traits the same as for mixins? (http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_module...)


yeap definitely looks like it. I would not be surprised if Python has something similar too.

For me OO is not the big reason to use smalltalk. For me the biggest reason is the whole live coding environment which is a big plus for workflow and speed of development. But maybe other smalltalkers could chime in with features I am not aware of.

Also Pharo has Pooldictionaries , which are doing the same thing Traits are doing for methods , for instance variables. Probably Ruby has something similar too.

I really think highly of Ruby , its a really powerful language. The reason why I chose python instead is that I can't stand the "Pearl" syntax. All these weird symbols etc. Definitely not my thing and make code less readable to me.

But as a language Ruby looks great to me. So definitely would not recommend against learning it :)


Python has good multiple inheritance and as far as I've seen most sane people just use it to "emulate" mixins and even name their secondary parent classes like Feature1Mixin or DoesYTrait.

Traits seem like a great idea, but the only other language where I've seen it under the Smalltalk name of "trait" is... brace yourself :) ...PHP 5.4+.


Scala has traits, to great effect.


There are a few subtle, important differences...

Check out the original paper and they should become apparent:

http://web.cecs.pdx.edu/~black/publications/TR_CSE_02-013.pd...




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: