Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82427 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34090 invoked from network); 11 Feb 2015 07:08:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2015 07:08:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 209.85.192.178 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.192.178 mail-pd0-f178.google.com Received: from [209.85.192.178] ([209.85.192.178:44421] helo=mail-pd0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/86-33902-5FFFAD45 for ; Wed, 11 Feb 2015 02:08:37 -0500 Received: by pdbft15 with SMTP id ft15so2533659pdb.11 for ; Tue, 10 Feb 2015 23:08:35 -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=3/sXO0gsPJXA3Rn9hr9LaqDxHZB7WF3zQABli+QMmE8=; b=b1Ph3XboPt5aq8q+0YZP9BKrYC21t9UbiDpnhXvfjpZAHH9HQicRGZJD3MB9fadSPv aeeUqh6g2taBpgn36DudmkLKIZEYIB+9ozShhXQF12IQxFT0payq4nbT7AU2K6uJnMve aGibAKW/aLUMaoEyoDK4cCK7c/ptj4ugrVXPi8nboZqhYacOhImPOHvvMjuLUDFbNogh kjvmaYk9S+667/TJescCnMoO5fnfbRecPkGbvpmSvUJ9cZ6TxHoWQ5zTARqq3QR7oQos MJ3T8yPhtd/rU3/ucDGwIsM4+Xz42550oWk0zRymjfa0LQdKK9NWkzFGPxQuYCHLOwx/ ssvA== X-Gm-Message-State: ALoCoQk9VquXyIdPnKNn9sGWkCO7Vkuw0rNfM6ArSOntlHEW0fg+uLfLe9Pci7wfyFmCL2+egCqE MIME-Version: 1.0 X-Received: by 10.68.109.195 with SMTP id hu3mr14239849pbb.84.1423638514872; Tue, 10 Feb 2015 23:08:34 -0800 (PST) Received: by 10.70.49.100 with HTTP; Tue, 10 Feb 2015 23:08:34 -0800 (PST) X-Originating-IP: [109.145.22.92] In-Reply-To: References: <54D7ED22.3080001@gmail.com> Date: Wed, 11 Feb 2015 07:08:34 +0000 Message-ID: To: Dmitry Stogov Cc: Yasuo Ohgaki , Patrick Schaaf , internals Content-Type: multipart/alternative; boundary=047d7b86f356f7ce71050ecaab6b Subject: Re: [PHP-DEV] Design by Contract From: pthreads@pthreads.org (Joe Watkins) --047d7b86f356f7ce71050ecaab6b Content-Type: text/plain; charset=UTF-8 D has them: http://dlang.org/interface.html#interface-contracts Maybe we could allow pre/post contracts but invariants don't make sense on interfaces. The question is, do we want to make them always available when possible, or do we want to make them available where it seems most useful and or least complex ? I prefer the latter, everyone else ? Cheers Joe On Wed, Feb 11, 2015 at 7:02 AM, Dmitry Stogov wrote: > I think we can't support contracts on interfaces and abstract methods. > How D works? > > Thanks. Dmitry. > > On Wed, Feb 11, 2015 at 1:56 AM, Yasuo Ohgaki wrote: > >> Hi Dmitry and Joe, >> >> On Wed, Feb 11, 2015 at 6:29 AM, Yasuo Ohgaki wrote: >> >>> On Tue, Feb 10, 2015 at 8:53 PM, Dmitry Stogov wrote: >>> >>>> You are welcome to edit https://wiki.php.net/rfc/dbc2 >>>> It looks like we have similar views, so just make it better in a way >>>> you think. >>>> >>> >>> Looks good to me. It's much better than original. Thank you folks. >>> We have related issue like how internal module incorporate with DbC. >>> However >>> these could be future issues. >>> >> >> A little more clarification, following interface definition is allowed >> or not? >> >> interface Some { >> >> require($this->last_result > 1000); // Force classes to have >> $this->result >> >> function bar($a, $b) >> require($a > $b) >> return($ret, $ret > 1000); >> >> function getLastResult() >> return($ret, $this->last_result === $ret); >> >> } >> >> I suppose it is supported, but it may be better to be explicit. >> >> Regards, >> >> -- >> Yasuo Ohgaki >> yohgaki@ohgaki.net >> > > --047d7b86f356f7ce71050ecaab6b--