News for hackers. Stuff that matters.
Re:PHP Sucks by adimitrov on Thursday June 16, 2016 @11:06AM (#11916623)
In which ways do Traits of all things help write good, disciplined code bases?

I think traits, and their Java equivalent, are OK to touch up legacy APIs (as they did with the Java collections API) but I have found no good place to stick them in a new project.

Not to say PHP hasn't been introducing functionality for writing good, stable code bases (type hinting in function signatures, namespaces, better garbage collection, an actual AST — as an aside: how ON EARTH did they do without an AST pre-PHP7?) but traits don't strike me as the feature to think of when designing a new code base.

They're not extendable, they're not overridable, they're monolithic, and classes expose their implementation details to them, which makes traits super fragile.

Re:PHP Sucks by ryanlm on Thursday June 16, 2016 @12:32PM (#11917185)
They emitted oplines to the opcode array directly from the parse production.