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

I completely agree. If Traits are something you really need, you're using the wrong language. If you need a screw driver, get a screw driver. Don't try to use the claw of a hammer. Developing with something like this will only increase the spaghetti factor. If you are a stickler for code re-use, my suggestion is to favor Composition over Inheritance.

It's also worth noting that PHP will most likely be adding Traits into the core language at some point. A patch has been available since 2008:

http://wiki.php.net/rfc/traits

Hell, if you really need traits (you don't), apply the patch. Just don't mutilate your code base.



Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

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

Search: