Pedro Cordeiro wrote on 25/11/2015 17:04:
2015-11-25 14:53 GMT-02:00 Rowan Collins <rowan.coll...@gmail.com
<mailto:rowan.coll...@gmail.com>>:
If it helps, just think of /** ... */ as not being a comment, but
already a first-class piece of syntax.
Except that it won't parse some stuff while parsing some other stuff.
There was a topic on reddit some time ago with a rant I wrote about
it, and the community seemed to support the notion that comment
annotations are bad:
https://www.reddit.com/r/PHP/comments/1ztstd/rant_it_baffles_me_that_people_think_using/
A very quick response to that rant:
> 1) Some php bytecode compilers (for example, facebook's hiphop) will
strip your comments. STRIPPING COMMENTS SHOULD NEVER BREAK YOUR APP.
So, let's make sure we treat these as first-class entities not comments,
and mention it in the language standard (drafted by Facebook, so that
they can make HHVM maximally conformant) that these MUST NOT be stripped
by compilers or pre-processors.
> 2) No IDE hints, no IDE syntax checking because, you know, THEY ARE
COMMENTS. If you think I should download a specific IDE plugin to work
with Doctrine and another one to work with Symfony and yet another one
to work in your specific project with your custom annotations, you can
go F@#$ yourself.
Total strawman: IDEs parse all sorts of information out of docblocks.
They may not parse annotations *because they're not standardised*, but
if there were a PSR defining them, I bet the plugin for parsing that
syntax would soon be bundled with any IDE with decent PHP support.
> 3) Coupling, separation of concerns, encapsulation: having
@Route("/something") in a controller class is AWFUL.
This appears to be a rant about annotations in general, not the syntax
used for them.
> 4) Dude, what does "@ManyToMany" do? Oh, ok, and what does "@param"
do...? HOW THE HELL AM I SUPPOSED TO TELL SOMEONE "oh, this part over
here is metadata, but this one is just a comment"? How do I distinguish
between the two of them?
Well, no, they're both metadata, just with different targets - @param is
targeted at IDEs and documentation generators, @ManyToMany is targeted
at a run-time hook, or maybe a code-generation one, or, well, anything
that wants metadata about something.
I'll stop there, because you probably already had this discussion at the
time, but since you linked...
Regards,
--
Rowan Collins
[IMSoP]