Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89418 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38362 invoked from network); 25 Nov 2015 17:11:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Nov 2015 17:11:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.42 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.42 mail-wm0-f42.google.com Received: from [74.125.82.42] ([74.125.82.42:34571] helo=mail-wm0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 87/B3-19088-1DBE5565 for ; Wed, 25 Nov 2015 12:11:45 -0500 Received: by wmvv187 with SMTP id v187so266961524wmv.1 for ; Wed, 25 Nov 2015 09:11:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:references:to:from:message-id:date:user-agent:mime-version :in-reply-to:content-type; bh=YrUZeFHCDMuoTnq+zAD9IltDfRg/ee0Us8B/WaI7gOU=; b=ACRzNOGH3G8n6PA+YyksMUfyGdcxqlyNsZ0SxMgpQnaqVXzF1boCqoEOEvAaiqNUOO P4OqMXx8HnP5JZuU6g5GvbEm5hWnmBKQiDXdlHfYN+GpUM4NsHIYThzRPr6PugoDZAck j9k2/gpjUz8L+YxMzWIgXiWU789VXyqSxIVJVPfLwdbqrqHHTdJ8ZCaTcBR2siUi1XK5 v7dRTZhM7+f7JkSLMU+evHqVAhRQHJleSQ9xmxNF6+KsABkUaGtsKuJ0qoVja6nFrQfg 5sdZ0oFcAky+q3E2/OfMEYh4CrqbFTdcnSbkSeqY3l2zV6aAVBYiyj9VZ6jxp1K8rZN/ XIDA== X-Received: by 10.194.78.212 with SMTP id d20mr48353796wjx.70.1448471502611; Wed, 25 Nov 2015 09:11:42 -0800 (PST) Received: from [192.168.0.147] ([93.188.182.58]) by smtp.googlemail.com with ESMTPSA id v196sm4420228wmv.10.2015.11.25.09.11.41 for (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Nov 2015 09:11:42 -0800 (PST) References: <5654B516.4020700@gmail.com> <5655E790.9060408@gmail.com> To: PHP Internals Message-ID: <5655EB97.2080608@gmail.com> Date: Wed, 25 Nov 2015 17:10:47 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------060504070208050606010601" Subject: Re: [PHP-DEV] Native Annotation Syntax From: rowan.collins@gmail.com (Rowan Collins) --------------060504070208050606010601 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Pedro Cordeiro wrote on 25/11/2015 17:04: > > 2015-11-25 14:53 GMT-02:00 Rowan Collins >: > > 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] --------------060504070208050606010601--