Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82649 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25378 invoked from network); 13 Feb 2015 23:31:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Feb 2015 23:31:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.42 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.192.42 mail-qg0-f42.google.com Received: from [209.85.192.42] ([209.85.192.42:61778] helo=mail-qg0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C9/91-15073-2498ED45 for ; Fri, 13 Feb 2015 18:31:14 -0500 Received: by mail-qg0-f42.google.com with SMTP id z107so15812564qgd.1 for ; Fri, 13 Feb 2015 15:31:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=rqkWGoAnmZOjM1KndtXX6UGtB5jI8hMCVEJuric5I7c=; b=uIq56Nthj5poLzVOOuVM9aqHmldA0sgaDMbied3hh7Q25TCKtb9dMBlQ2ZheAEm6z5 Y6jXOBEf8S0J9So564IZnOFMLhTvUTd1g1WR9EENFQuWRmhVJjYB50BmIPTAc4i+UOKK SQB39Vvc9VipvPTzP4FJaqNExG5yxXEaF3/HfiL9i7CQkTljwgWIucd6X/QdRjt+i/aJ ftzZO4Bh5kW2DuCY+z8T+zSPDc0Ur81sA9ExiXXnNZWRzfjBwdX6/X9zteTyUpvxDSBl cT2hT0wDC5xv4oKoE4ZjyVXYDPbBtxWnSamNKi4+KR+/qmtjhOkestmZh8QTqbXUWXwO zalA== X-Received: by 10.140.97.203 with SMTP id m69mr28388196qge.39.1423870271634; Fri, 13 Feb 2015 15:31:11 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.229.198.8 with HTTP; Fri, 13 Feb 2015 15:30:31 -0800 (PST) In-Reply-To: References: <54DAFD32.3000005@gmail.com> <54DB0BC0.20304@gmail.com> <54DBA801.8060403@gmail.com> Date: Sat, 14 Feb 2015 08:30:31 +0900 X-Google-Sender-Auth: n97YrvIHkqGhHmPOVbaXAp5YcrY Message-ID: To: Dmitry Stogov , Joe Watkins , =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= Cc: Stanislav Malyshev , PHP Internals Content-Type: multipart/alternative; boundary=001a113a2aa2bf4cf5050f00a1e4 Subject: Re: [PHP-DEV] Design by Contract From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a113a2aa2bf4cf5050f00a1e4 Content-Type: text/plain; charset=UTF-8 On Sat, Feb 14, 2015 at 8:19 AM, Yasuo Ohgaki wrote: > myMethod() { > require(MyMethod()); > } > My hand is not used to new syntax yet. This should be. myMethod() require(myMethid()) { /* */ } ========== 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 --001a113a2aa2bf4cf5050f00a1e4--