Live data from Hacker News

PHP Annotations Are a Horrible Idea

theunraveler.com

71–80 of 127 posts

Re: PHP Annotations Are a Horrible Idea

#71
post #69

Earlier quoted context omitted.

If annotations are in comments, how are you going to leave actual comments containing annotations that you don't want to actually affect the code?

by escaping them? Some annotations are meant to affect the code, some aren't. Those who do and need to be given as pure comments need to be escaped.

So now you have a system for putting comments inside your comments? Are you going to eventually start putting meta-annotations inside your meta-comments, and inventing meta-meta-comments so you can comment on the meta-annotations?

Re: PHP Annotations Are a Horrible Idea

#72
post #64
post #5

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 tha…

It's really bad practice. We all want to get stuff done, but don't complain when you end up in spagethi code hell. Some people are going to see that and think that's an ingenious use of comments, and then start to do the same in everything they write soon after. If you ever seen Preprocessor abuse in C++ you know what I mean.

give us a pointer to an example please.

Re: PHP Annotations Are a Horrible Idea

#73
post #41

Earlier quoted context omitted.

I would argue that it's better for configuration and application logic should be separate though. You can run the same appliation with a different XML configuration without modification of the source. You couldn't do the same with in-comment configuration.

Fair enough. Then it sounds like your problem is really with annotations, and not that much about the in-comment part of this.

Yes, and it's not limited to PHP. I don't particularly like how Flask (python) uses decorators for its routing as well.

Re: PHP Annotations Are a Horrible Idea

#74
Annotations (or decorators) are good idea as it is — they are very popular in Python. The bad part is that they are implemented horribly — as comment which are later parsed.

This should be implemented in PHP core or at least someone should write extension for it. That would solve implementation problems and add new, good feature to PHP language.

Re: PHP Annotations Are a Horrible Idea

#75
post #69
post #5

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 tha…

If annotations are in comments, how are you going to leave actual comments containing annotations that you don't want to actually affect the code?

By not using / * * to start your comment block ?

Re: PHP Annotations Are a Horrible Idea

#76
Couldn't agree more. Every time I use annotations I feel dirty...

Programmers who talk so much about code separation, clean modular structure etc are the same ones are willing to use annotations. What got into them?

Disclaimer: I like code to be elegant. And practical. This is PHP we're talking about, but no need to do more bad choices...

Re: PHP Annotations Are a Horrible Idea

#77
post #5

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 tha…

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. Maybe it is subjective, but it sure gives me an icky feeling. You're breaking down a clear division between code and comment - fuzzing the lines. There's something about the idea that yes, I can only describe as being gross. To each thei…

Some people don't like 4 space indentations, some don't like using tabs, and in most cases there's just an icky feeling behind it. Who's right?

In your own post, you give a reason for why you think (and not feel) it is wrong, and that's the right way to do. Icky feelings aren't. Maybe people saying that it feels wrong are crossing a line too?

Re: PHP Annotations Are a Horrible Idea

#78
post #5

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 tha…

> I'll take the first one because I have other shit I need to do. Uhh, what's so hard about making an array?

verbosity.

Re: PHP Annotations Are a Horrible Idea

#79
post #69

Earlier quoted context omitted.

If annotations are in comments, how are you going to leave actual comments containing annotations that you don't want to actually affect the code?

By not using / * * to start your comment block ?

If you're going to have different syntax for annotations and actual comments, why not choose a syntax that's properly different and not just a weird mutation?

Re: PHP Annotations Are a Horrible Idea

#80
post #19

> the PHP community is now officially so desperate for better metaprogramming capabilities that it is attempting to do so using code comments This says it all ... and to be honest, from an ease point of view I like using annotations but as with most parts of PHP it's the implementation that sucks (or the lack of implementation) Over 2 years ago a RFC has been filed for native php annotations and I must say that I lik…

That somebody could be you!

Problem is not finding someone to implement it, problem is getting the core devs on one line concerning the syntax/implementations. There have been numerous suggestions but none were deemed good enough, and maybe for good enough reasons I might add.

http://marc.info/?l=php-internals&m=130496081925265&...

Post reply on HN