Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82743 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 85523 invoked from network); 15 Feb 2015 19:38:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Feb 2015 19:38:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.220.173 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.173 mail-vc0-f173.google.com Received: from [209.85.220.173] ([209.85.220.173:38176] helo=mail-vc0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/BC-06835-8B5F0E45 for ; Sun, 15 Feb 2015 14:38:33 -0500 Received: by mail-vc0-f173.google.com with SMTP id hy4so9450647vcb.4 for ; Sun, 15 Feb 2015 11:38:29 -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=YNnfDCjnLJ2m703zpEiUwV0eZH3ct7t53ooFSdGQJKw=; b=bfUaXfSPmZsY+fy9kdcl8niS6XUycqHlG5BJpfN/SjDeh5IVXHat5snGzBg8Ab+qrZ aah3T/O5Au4/WcboXFvFA63h55MztN3tGzeE9j2ZeXHkDm0zSNfPTFUhtz5sDwhJgZpp bwTEUm0kayZlCSfzv6R4eMiDNcrgWjw6uPUunPKItNGjhOP6t/eFg3CZNYJmESkXEXG4 /GJYfv+1dxmyV8GpcXJZLvhpSwxU8CRAVlohd2+fYVfOf2gFIHvs3jlbX7gGpOIt9UTs 4ZpJG+Mqc+kTpaKq3dTVR24Mc2UiCOxDJvtZEvabvV/5Nj3L1MrAFYB/R0rUo5CMaNGb wAJQ== X-Gm-Message-State: ALoCoQn4hcY6T4Fcrsl2sW599x9a9rGQtop79MJx980w0kBcOX+Ehbdnzk5+pFEM6xn+GjfuWxrRXt80QUpEJTgsbEp4/2vzhpw64yEa7S0hyiGHOHgr5JWnz+k8RG8Czn6K3bsUpWhwyhUsKglWE0qARevdTF8RYg== MIME-Version: 1.0 X-Received: by 10.221.18.136 with SMTP id qg8mr13921750vcb.27.1424029109293; Sun, 15 Feb 2015 11:38:29 -0800 (PST) Received: by 10.52.74.73 with HTTP; Sun, 15 Feb 2015 11:38:29 -0800 (PST) In-Reply-To: <000a01d04939$aae34910$00a9db30$@php.net> References: <54DAFD32.3000005@gmail.com> <54DB0BC0.20304@gmail.com> <54DBA801.8060403@gmail.com> <013801d0481d$d34c5170$79e4f450$@php.net> <000a01d04939$aae34910$00a9db30$@php.net> Date: Sun, 15 Feb 2015 23:38:29 +0400 Message-ID: To: Yasuo Ohgaki Cc: Joe Watkins , =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= , Stanislav Malyshev , PHP Internals Content-Type: multipart/alternative; boundary=001a113399e6359d70050f259dda Subject: Re: [PHP-DEV] Design by Contract From: dmitry@zend.com (Dmitry Stogov) --001a113399e6359d70050f259dda Content-Type: text/plain; charset=UTF-8 > - Consider introduction of static require() as class invariant for static > methods > invariant contacts are executed in object methods. I meant adding "static invariant" to be executed on static methods. but I think we don't need them at this point. > > I probably don't understand the idea correctly. Could you give some > explanations? > > - Need to discuss syntax > > There were many ideas for possible syntaxes, I prefer current simple > syntax. > Syntax is not my priority. I don't mind require{assert();}, > return{assert();}, etc. > Since "error message" can be added and any expression is allowed, writing > contracts > as code may be better. We are better to avoid new keyword whenever it's > possible. > > - How to manage votes for 2 RFCs > > Both RFCs are large enough. How about make vote only RFC > https://wiki.php.net/rfc/dbc_vote > - Explain what is DbC. > - Choose "Introduce Native DbC for PHP - Yes or No" > - For people voted for Yes, "Annotation or Code" refer > links to https://wiki.php.net/rfc/dbc, https://wiki.php.net/rfc/dbc2 > - Choose "Annotation or Code" > > Sounds good. Alexander should provide one more proposal based on annotations or attributes. > > ==Annotation DbC Implementation== > Dmitry, I guess it wouldn't be too hard for you to implement this RFC. How > about annotation > version? Can it be implemented with reasonable amount of efforts? > any implementation of DbC is going to be not trivial... Thanks. Dmitry. > > > Thank you all those who are contributed discussion! > I hope you choose to have DbC support. DbC helps to achieve > "strict/precise development" > and "maximum performance in production" at the same time. > > Regards, > > P.S. It takes time to get used to new syntax. We may be better try to > expose new syntax > as much as possible. i.e. Put new syntax in mails whenever possible. > > Native DbC support syntax: > class Child { > require($this->age < 18); // Invariant (Class state condition) > > public function someMethod($input) > require(somethingAbout($input)) // Precondition > return($ret, somethingReturn($ret)) // Postcondition > { > /* Great! We are certain that caller satisfy precondition, return > appropriate return value and have proper class state! */ > } > } > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net > > > --001a113399e6359d70050f259dda--