Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81945 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29775 invoked from network); 5 Feb 2015 16:36:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Feb 2015 16:36:16 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.176 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.176 mail-vc0-f176.google.com Received: from [209.85.220.176] ([209.85.220.176:63179] helo=mail-vc0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2B/54-27691-FFB93D45 for ; Thu, 05 Feb 2015 11:36:15 -0500 Received: by mail-vc0-f176.google.com with SMTP id kv7so3065827vcb.7 for ; Thu, 05 Feb 2015 08:36:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=h1CQcXQ3pCgQYYXWKF5Tt22GxfCqh3Ln2MeMLAUJN88=; b=HNAYVBrrQFrhQoRCjZm0o8uQpeueuyETY5f/48fmpnLFE99Q2Y4aVRV2FQKVvlZrAB 0ezPmXHge7mDDpsD9bMoEX4JkIfY0u+r1Nx9zAZWdXOrbH7HBYDVIA6GwCSMS1LhBRCr nGyEsTZDCZzf3rlXZnrjGaSwgzMMyPbUGRiMuw/zlDmfoxS3B7prcUXsrphD7O4B8xPw +BZZLRozP4YuByq0Jn1XWP+XCU53vEbbF7B7fcCRXIqvCdpon6h/GBQr6XyIums4JjMa VvSZrmShKrm1PYxLuEf0TIpoUMJNAAxU/7rnG2BaHs/BabZWHBO9rw+mLdq+ATjTQN6l aQ0A== X-Gm-Message-State: ALoCoQlg65e5ag/+dYb/kVoCbG2xlOa0GxVcicfpAAsYgx4ZGxjmx+cz1cDLBR8pL1yFlUhkDsCnSxTkhZ6GO2QcK4PNUpZ23WBRX7Z0nZQmX1/jE7CazRQiwcbPjoIx+z6CiMnqfYNc7TDv2qZ+Kma+j4PpSCpc0Q== MIME-Version: 1.0 X-Received: by 10.221.21.131 with SMTP id qs3mr2773565vcb.33.1423154171926; Thu, 05 Feb 2015 08:36:11 -0800 (PST) Received: by 10.52.74.73 with HTTP; Thu, 5 Feb 2015 08:36:11 -0800 (PST) In-Reply-To: <022801d0415a$027e0620$077a1260$@tekwire.net> References: <01d601d04146$6fbda4c0$4f38ee40$@tekwire.net> <020c01d0414b$2c3a1120$84ae3360$@tekwire.net> <022801d0415a$027e0620$077a1260$@tekwire.net> Date: Thu, 5 Feb 2015 20:36:11 +0400 Message-ID: To: =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= Cc: Pierre Joye , Yasuo Ohgaki , PHP internals Content-Type: multipart/alternative; boundary=001a11339f8ae0f24f050e59e6f9 Subject: Re: [PHP-DEV] Design by Contract From: dmitry@zend.com (Dmitry Stogov) --001a11339f8ae0f24f050e59e6f9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable phpdoc is annotation as well, but to split it into specific attributes we have to write specialized parsers. Other languages support annotation or attributes that may be used more easily. http://docs.hhvm.com/manual/en/hack.attributes.php Thanks. Dmitry. On Thu, Feb 5, 2015 at 6:40 PM, Fran=C3=A7ois Laupretre wrote: > De : Pierre Joye [mailto:pierre.php@gmail.com] > > >> Yes, it makes phpdoc more tied to the engine but is it a problem ? > > > > And here I have to jump in and say: don't. > > And remind about one of the exact purposes of annotations. > > Sorry, I am not sure I understand. > > If you're talking about the link between the engine and phpdoc comments, = I > agree. It is not a job for the PHP engine. It is a job for a script > pre-processor, contained in an extension, and called BEFORE the file star= ts > to be parsed by the engine, not after the AST is generated. It is very ea= sy > to pre-process PHP scripts and insert PHP code for DbC checks, while doin= g > the same using an AST and generated opcodes looks much harder to me. > > As I told Alexander, in my opinion, phpdoc blocks already provide a lot o= f > useful DbC information. My objective is to extend the syntax to support > more complex directives, which are still legitimate phpdoc information. I > see both concepts as closely related. One is generating documentation, on= e > is generating runtime checks, but both use the same information. > > About annotations, I don't know much about it, as I was naively thinking > that phpdoc '@' directives were annotations, but I understand I was > probably wrong. The only concern I have about introducing a new annotatio= n > syntax is BC break. > > Cheers > > Fran=C3=A7ois > > --001a11339f8ae0f24f050e59e6f9--