Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82321 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54474 invoked from network); 9 Feb 2015 23:48:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Feb 2015 23:48:41 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.47 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.216.47 mail-qa0-f47.google.com Received: from [209.85.216.47] ([209.85.216.47:36160] helo=mail-qa0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5B/A0-47508-85749D45 for ; Mon, 09 Feb 2015 18:48:40 -0500 Received: by mail-qa0-f47.google.com with SMTP id v10so83598qac.6 for ; Mon, 09 Feb 2015 15:48:38 -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=aISKSVepoFSUmSP+h/EFvx0VUD+HwpSB83DPHLJ3FiQ=; b=lqb/9bej0F2HkXZv0q9mFkiUa5uH8cfVCoUyLSU/Pu5aFdCO70j6uzd+hC/ioum7ub fGyPSxnFrCFcdYxzmiZIp78IvdV8p97jnIZ5f/gE+wl3BvloyNJaPJVoNRaH+yZfhE6I WBVZP88hZsxxJjPWwx05vpzXnaFZLD3d5LgHXeHLfcx0iPlTFHuccsXbAf3Mexjh/6Dj JCjDiPlQEAW/zqqFq1Ri5RYSJQUZr10k4Bw2sOAMTyPwlwQ1yOy8SPt8x5v8XepHFkK0 SWS7esTjEqplQnEPxqj6StBJYr9sucjr32rZxmXmTmoUxku9iVgjPhfwqAqH5/k5Yxn1 SdKA== X-Received: by 10.140.42.83 with SMTP id b77mr40249978qga.43.1423525717923; Mon, 09 Feb 2015 15:48:37 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.229.35.200 with HTTP; Mon, 9 Feb 2015 15:47:56 -0800 (PST) In-Reply-To: References: <54D7ED22.3080001@gmail.com> Date: Tue, 10 Feb 2015 08:47:56 +0900 X-Google-Sender-Auth: 4mHejlfwsJHMSXOaOWKfBckUVI0 Message-ID: To: Dmitry Stogov , =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= Cc: Joe Watkins , Stanislav Malyshev , PHP Internals Content-Type: multipart/alternative; boundary=001a11c13054bedd0c050eb06848 Subject: Re: [PHP-DEV] Design by Contract From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11c13054bedd0c050eb06848 Content-Type: text/plain; charset=UTF-8 Hi all, On Tue, Feb 10, 2015 at 5:27 AM, Yasuo Ohgaki wrote: > On Tue, Feb 10, 2015 at 5:19 AM, Yasuo Ohgaki wrote: > >> Use of interface: >> - no additional keyword (pros) >> - requires interface for DbC, most classes does not require interface >> (cons) >> - if interface is not used, user has to repeat invariant conditions >> over and over (cons) >> - requires to define method that should not exist in production (cons) >> >> New keyword: >> - does not require interface for efficient definition (pros). >> - new keyword (cons) >> >> It seems we are better to choose proper keyword for 'invariant'. >> 'invariant' is not common, so 'invariant' >> may be good enough choice. Does anyone use 'invariant' as >> function/method/class/constant names? >> If there is better name, suggestion is appreciated. >> > > It might be be better to use special method. No keyword, use only reserved > method name __func(). > I'll write what I think that are better for PHP in the RFC. > We may discuss anything here to complete the RFC. > The RFC draft is ready. https://wiki.php.net/rfc/dbc2 I think we might be better to use return($ret) { assert($ret > 0); } as the syntax. It doesn't look like definition, but code though. We may introduce $> or like as return value, but it looks like PERL. It's not for me, but PHP stands for People Hate Perl for some. Any comments, corrections, improvements are appreciated. If anyone could fix bad English, it would be great! Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11c13054bedd0c050eb06848--