News for hackers. Stuff that matters.
Re:PHP Annotations Are a Horrible Idea by mikeash on Wednesday October 17, 2012 @10:13AM (#4664484)
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?
Re:PHP Annotations Are a Horrible Idea by tomcorrigan on Wednesday October 17, 2012 @10:59PM (#4667293)
Easily, the annotation parser ignores all comments that it doesn't recognise.

    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * some comment that the doctrine parser will ignore completely
     */
    private $id;
Re:PHP Annotations Are a Horrible Idea by prunebeads on Wednesday October 17, 2012 @10:14AM (#4664492)
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.

Re:PHP Annotations Are a Horrible Idea by mikeash on Wednesday October 17, 2012 @10:16AM (#4664499)
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 by prunebeads on Wednesday October 17, 2012 @04:02PM (#4666151)
Actually, no. What I have now is comment blocks which may contain normal annotations and escaped ones. There's no need to go deeper in meta-meta-something.

Regarding the comment inside comment system, if it were possible to have nested comments, it wouldn't be a problem anymore :). Since it's a Symfony convention, one could simply count the number of stars at the beginning of a comment line to know the meta-comment depth level. BTW, I know that you are being sarcastic here.

Anyway, this is beside the original problem. Annotations in comments are a problem, granted, but somewhat limited. It's easier and faster for a parser to look for comments and then annotations in them, rather than parse the whole PHP grammar augmented with annotations. Especially in PHP.

Re:PHP Annotations Are a Horrible Idea by Dylan16807 on Wednesday October 17, 2012 @12:56PM (#4665349)
So now you have a system for putting quotation marks inside your strings? Are you going to eventually start putting escaped-quotation marks inside your escaped-quotes, and inventing escaped-escaped-quotation marks so you can quote the quoted-quotation marks?

In other words, there is no need for some kind of elaborate escapes-upon-escapes method here, all you have to do is not start a comment line with *@.

Re:PHP Annotations Are a Horrible Idea by conradfr on Wednesday October 17, 2012 @10:30AM (#4664571)
By not using / * * to start your comment block ?
Re:PHP Annotations Are a Horrible Idea by mikeash on Wednesday October 17, 2012 @10:42AM (#4664635)
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 by robryan on Wednesday October 17, 2012 @04:58PM (#4666407)
Because they want something that is still valid PHP.
Re:PHP Annotations Are a Horrible Idea by mikeash on Wednesday October 17, 2012 @06:12PM (#4666651)
But why? Do I misunderstand that these annotations change the meaning of the code? Why would you want something that's still valid PHP without them, but means something else?