| This is pure horse pucky. First of all PHP isn't about elegance and I find it a teeth grinding experience when people complain about it not being so. PHP is about getting stuff done. He doesn't offer one good valid technical reason why not to use comments for meta-programming PHP other than "it just feels wrong" and an "icky feeling" which is entirely subjective. "Reliance on Yet Another Library"? C'mon. The fact that you can even parse out comments with the reflection API lends, to me, that meta-programming is a-ok. Also, his alternatives are kind of weak. Here's an annotation: /**
* @Column(type="string", length=32, unique=true, nullable=false)
*/
protected $username;
And here's his proposed alternative: class User
{
public static $mapping = array(
'username' => array(
'type' => 'string',
'length' => 32,
'unique' => true,
'nullable' => function() {
// Some logic to determine value.
}
)
);
}
I'll take the first one because I have other shit I need to do. |
> First of all PHP isn't about elegance...PHP is about getting stuff done.
What language isn't about getting stuff done?
> He doesn't offer one good valid technical reason why not to use comments...
Not true. The OP explicitly points out that it breaks many PHP debugging capabilities.
> The fact that you can even parse out comments with the reflection API lends, to me, that meta-programming is a-ok.
So what? PHP also has a goto function. Should we use it just because we can?
> I'll take the first one because I have other shit I need to do.
Just because it's less verbose doesn't mean it's better. Otherwise, everyone would use Coffeescript instead of JS.