Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49634 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39911 invoked from network); 13 Sep 2010 18:12:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Sep 2010 18:12:35 -0000 Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-ww0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:33730] helo=mail-ww0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1E/89-24501-2996E8C4 for ; Mon, 13 Sep 2010 14:12:35 -0400 Received: by wwb39 with SMTP id 39so4430720wwb.11 for ; Mon, 13 Sep 2010 11:12:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=99FZLH+tMDUKd3iVP72Cxr9agidowCMtvze5T9OFqxw=; b=qXJ3GyrkJwGKc2Y0RRehYo+FMFVmcS3cne4MxnveBtl0LezbpmuOS6M5uL9V0BA2GC KOcSNf67SzalEnZjmHKS6y35/g6cGMbRyDRk4N7ZZ+c7y2QpvOvi30rgxveJjhV/VCRR Gp5QdhIJ17FYOV4TBmv9tW+GwiGGszBtvC3w4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=u1tW88EjYMS/BsRFj3znKLsbv2WTs+U03tBjMRyM2GQsEoHJM/lHZj6AG0ZW64g5fp /0Rc+O2jMuYfhE9/qywQpf39ijEZUSKbq0pyf/X66XRr90MELEPugQlTHMoraHK2LEfq CpAvdXuiMcNDc6q8q07EV+S+8VGQaIi+1rNlA= MIME-Version: 1.0 Received: by 10.216.153.140 with SMTP id f12mr2891970wek.111.1284401548538; Mon, 13 Sep 2010 11:12:28 -0700 (PDT) Received: by 10.216.55.130 with HTTP; Mon, 13 Sep 2010 11:12:28 -0700 (PDT) In-Reply-To: <7.0.1.0.2.20100913174031.0d227918@zend.com> References: <4C873C0F.1010200@zend.com> <4C879613.7090709@zend.com> <4C887D2B.2000605@zend.com> <4C8AC526.7000505@sugarcrm.com> <4C8B6168.30504@mohiva.com> <4C8BC81E.8000605@sugarcrm.com> <7.0.1.0.2.20100913145703.0d226d90@zend.com> <0f5a11f744bbcf99d8217f40da3a302a@beberlei.de> <7.0.1.0.2.20100913174031.0d227918@zend.com> Date: Mon, 13 Sep 2010 15:12:28 -0300 Message-ID: To: Zeev Suraski Cc: Benjamin Eberlei , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: PHP Annotations RFC + Patch From: guilhermeblanco@gmail.com (Guilherme Blanco) Hi Zeev, On Mon, Sep 13, 2010 at 12:44 PM, Zeev Suraski wrote: > Benjamin, > > Strictly speaking annotations are not *needed*. =C2=A0They simply aren't = - you > can do anything and everything you might want to do without them. =C2=A0Y= ou can > argue that the value they bring is very important, and that it outweighs = the > complexity they bring upon to the language - in which case we can agree t= o > disagree. Do not consider it as a rude comment, it's a rather reflective one. What about goto; was it needed? You added worse support into PHP for much l= ess. I constantly see every attempt to make PHP a better language is turned into endless discussions. Am I wrong? I can highlight more than 10 since I started to follow internals ML. As of goto, I see only one usage to it: parsers. Annotations have much more usage than you imagine. You can control class access, validate the classes through a Service (or an ortoghonal Aspect using an extension that already exists), unit test, turn into a persistent class, document for a tool (like phpDoc). Frameworks can use it to determine controller (instead of keeping users to extend an abstract class or interface), etc. I tend to agree the syntax may not be ideal, but that's why we opened the patch for review and polish. Years ago I poked a lot of people to join forces and let this support IN for PHP 5.3, without success. Of course I completely understand that people have other obligations and that's why I sadly saw PHP 5.3 out of the box without a lot fo support I expected. What I highlight on RFCs are support that not only me, but tons of developers have troubles daily and do not know the ways to reach PHP core to suggest changes. I eat PHP's dog food daily and I clearly know every single deficiency it ha= s. Cheers, > > Zeev > > > At 17:38 13/09/2010, Benjamin Eberlei wrote: > >> I strongly disagree! >> >> PHPDocs are for what their name suggests, for comments, not for runtime >> code information. They allow arbitrary characters, their intent is for >> human-readible documentation only. >> >> Yet they are used for service description (Zend_Soap_Autodiscover, >> Zend_XmlRpc), metadata mapping or phpunits "annotations", just because >> there is nothing better suited. >> >> Primary difference of Annotations, they are not only human- but also >> enforced to be machine-readable. Annotations are runtime configuration o= r >> metadata, throwing compile time parse errors when not followed correctly= . >> That has nothing to do with documentation, it is an very elegant way to >> extend classes, methods and properties with metadata information, >> configuration and code right next to each other. >> >> The primary target for annotations are framework and library integration= s: >> validation, forms, metadata mapping, static mvc configuration such as >> routing, view selection or acls. Why do these features not exist with >> current php libraries yet? Because developers see php doc blocks for wha= t >> they are: Comments! >> >> With Doctrine2 and Symfony2 we see some early experiments with annotatio= ns >> in PHP Docs, but they only highlight the drawbacks: >> >> 1. Developers should expect to be able to delete a comment/docblock >> without altering the code-path. >> 2. Errors in the Doc-Blocks "expected formatting" are left for the >> userland developer to detect. IDEs or the PHP Parser simply don't care. >> 3. There is no real difference for a human only readable doclbock starti= ng >> with /** or /*, however PHP just doesnt publish the /* docblocks to the >> userland, leading to countless errors when that single star is missing. >> 4. every IDE or code-highlighting prints them in light grey, making them >> sort of invisible. >> >> That is why annotations are needed, they make metadata a language level >> construct, not a hack that is possible, because Reflection allows us to >> access the comments of methods, functions, classes, ... >> >> greetings, >> Benjamin >> >> On Mon, 13 Sep 2010 15:05:57 +0200, Zeev Suraski wrote: >> > At 20:24 11/09/2010, Pierre Joye wrote: >> >>On Sat, Sep 11, 2010 at 8:19 PM, Stas Malyshev >> >>wrote: >> >> > Hi! >> >> > >> >> >> The separator never was a problem... but I definately don't want t= o >> >> >> see another 6 months just to define what would the separator be. >> >> >> If we need to drop [] in favor of array support, I vote for ! as >> >> >> separator. >> >> > >> >> > The separator is not a problem (even though 1-char one produces muc= h >> >> > less >> >> > clutter). The cryptic syntax is. >> >> >> >>It seems that there is a misunderstanding about the goals of the >> >>annotations. They are not meant to be read by human being >> >>(javadoc/phpdoc/etc. are) but to be parsed automatically to be used >> >>for services. >> >> >> >>In that sense, to have a syntax closed to one of the best (or less >> >>worst, if you are on the opposed side ;-) syntax out there (c#/.net) >> >>may be a good thing to do, instead of re einventing the php wheel. >> > >> > I'm not sure we've seen a good reason to add annotations instead of >> > using PHPDoc. =C2=A0Sure, PHPDoc isn't a perfect fit for certain purpo= ses, >> > but I think it certainly falls in the good-enough fit for most >> > purposes. =C2=A0It's also both machine and human readable, and best of= all >> > - it's already there. >> > There should be overwhelmingly strong reasons to add a whole new >> > branch of syntax to PHP, I for one don't see the huge gain >> > annotations bring on top of PHPDoc. >> > >> > Zeev >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Guilherme Blanco Mobile: +55 (16) 9215-8480 MSN: guilhermeblanco@hotmail.com S=C3=A3o Paulo - SP/Brazil