A Different Way: Traits in PHP
lucasoman.blogspot.com
A Different Way: Traits in PHP
1–9 of 9 posts
Re: A Different Way: Traits in PHP
#2Regardless, I think this is a pretty cool idea. It seems like a lot of effort to emulate what's (arguably) a missing language feature, but for those of us who are stuck in PHP for one reason or another, it's an interesting development.
Re: A Different Way: Traits in PHP
#3This article has spent an hour or two on the front page with no discussion. I've always wondered what that means; perhaps in this situation, it means that YC's active commenters aren't active PHP developers? Regardless, I think this is a pretty cool idea. It seems like a lot of effort to emulate what's (arguably) a missing language feature, but for those of us who are stuck in PHP for one reason or another, it's an i…
And I think you're right that YC's commenters are by and large not PHP developers. I've only known a couple of real hackers that work in PHP, and even they didn't work in it by choice. Though it makes me a little sad to say this because PHP was the first language I learned (hooray sentiment!), I hope PHP dies off soon. It has matured in recent years, but unfortunately not in any new directions. I'm gonna go out on a limb and say that the vast majority of PHP programmers are idiots who couldn't code their way out of a paper bag, and the better PHP hackers tend to be enterprise-y, as that's the direction PHP is headed nowadays.
Re: A Different Way: Traits in PHP
#4This article has spent an hour or two on the front page with no discussion. I've always wondered what that means; perhaps in this situation, it means that YC's active commenters aren't active PHP developers? Regardless, I think this is a pretty cool idea. It seems like a lot of effort to emulate what's (arguably) a missing language feature, but for those of us who are stuck in PHP for one reason or another, it's an i…
In response to the first bit, a friend observed that Warnock applies.
Re: A Different Way: Traits in PHP
#5Re: A Different Way: Traits in PHP
#6This article has spent an hour or two on the front page with no discussion. I've always wondered what that means; perhaps in this situation, it means that YC's active commenters aren't active PHP developers? Regardless, I think this is a pretty cool idea. It seems like a lot of effort to emulate what's (arguably) a missing language feature, but for those of us who are stuck in PHP for one reason or another, it's an i…
Yeah, it sounds kinda nice to me. But that' because I'm stuck with PHP for the time being. I'm tired of fighting the language though, so creating these kinds of hacks just becomes more of an intellectual exercise. And I think you're right that YC's commenters are by and large not PHP developers. I've only known a couple of real hackers that work in PHP, and even they didn't work in it by choice. Though it makes me a…
I consider myself a pretty good PHP programmer, but you're right, most of them out there don't deserve the title "programmer". I'm so disgusted by 99% of the open source PHP crap out there.
That said, I do look forward to learning new languages and new ways to develop on the web (what I really love doing).
Re: A Different Way: Traits in PHP
#7Perhaps if you need traits, you're doing it wrong. Does PHP really need all the added complexity of this? Does it really help solve the problem or did you just add a new maintenance nightmare?
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.
Re: A Different Way: Traits in PHP
#8Perhaps if you need traits, you're doing it wrong. Does PHP really need all the added complexity of this? Does it really help solve the problem or did you just add a new maintenance nightmare?
Re: A Different Way: Traits in PHP
#9Perhaps if you need traits, you're doing it wrong. Does PHP really need all the added complexity of this? Does it really help solve the problem or did you just add a new maintenance nightmare?
So your questions, does PHP really need all the added complexity of this?
That doesn't matter. If you don't need it, don't use it.
Does it really help solve the problem, or did you just add a new maintenance nightmare?
This question is a false dichotomy. First, it wasn't trying to solve any other problem then getting traits to work. So yeah, it solved that problem. Second, new code always adds new maintenance concerns. Whether or not it's a nightmare depends on the quality of code, which seems to be above par in this case.
As Nycto pointed out in this thread, there is a "Traits" patch which seems preferable to this code. It's likely that OP didn't realize it existed and did reinvent the wheel. But still, in terms of an exercise in PHP, I found it quite cool.