Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82437 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48471 invoked from network); 11 Feb 2015 07:26:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2015 07:26:21 -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.172 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.220.172 mail-vc0-f172.google.com Received: from [209.85.220.172] ([209.85.220.172:40151] helo=mail-vc0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C8/C9-33902-D140BD45 for ; Wed, 11 Feb 2015 02:26:21 -0500 Received: by mail-vc0-f172.google.com with SMTP id kv7so613641vcb.3 for ; Tue, 10 Feb 2015 23:26:18 -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=HlRuYBLKrftqYJEGdC+SRiv/ts4DP88MHYuv4feMx/0=; b=NA1j1jZGqmwS7jIgI48r/ttjPEAy6Kr9dulD8qmIlgRcXlpDctF+YIxMfRechL0Wf1 aCPUs/cKmYtdM2Wd8T8Rr/hWY93Zod/YMZoTinPV5Y/ZzVj3Q7K7qR7pVpmrkvi+fyKi anaT/dwP2th1gQ4HobhsFSzq4PtUFZvjGRSZvSGcK9cFpQsSjdM7ZevD0nVZDRcfwHyP CMk8WQG9WF47h1H1CU54t3hDsTbaC1aToKktA4eKP85S8RPqBVEHJnC7kC52tZzV9X8y eQFmcCGtfD4Vmx1yIonBgIPDFgjG5zox6QNpN4ooJbkgdi6GyErluPx/WnFi2H56H/XZ pWpw== X-Gm-Message-State: ALoCoQmZOJHxOQn6FrG8hQfTLJMHGYEDrW5X3qwVi+0kHc0so/CNEBKV0kJ6Y+Gxj4FLH0M8mL8aG03EMkOFpQ/urWOr2gBgsDRvPVOUmghnje8cohyFfUar2w7rOorTpYN2enx12QB/0yIUzasxnlkFt/T6i0hcYA== MIME-Version: 1.0 X-Received: by 10.220.98.136 with SMTP id q8mr5521930vcn.4.1423639578884; Tue, 10 Feb 2015 23:26:18 -0800 (PST) Received: by 10.52.74.73 with HTTP; Tue, 10 Feb 2015 23:26:18 -0800 (PST) In-Reply-To: References: <54D7ED22.3080001@gmail.com> Date: Wed, 11 Feb 2015 11:26:18 +0400 Message-ID: To: Joe Watkins Cc: Yasuo Ohgaki , Patrick Schaaf , internals Content-Type: multipart/alternative; boundary=001a11c20e52635882050ecaeb4e Subject: Re: [PHP-DEV] Design by Contract From: dmitry@zend.com (Dmitry Stogov) --001a11c20e52635882050ecaeb4e Content-Type: text/plain; charset=UTF-8 I think we should just repeat the related D semantic. It must be defined in contracts inheritance rules. What if we have contracts for prototype method in parent class and interface? Should we still validate contracts of parent and interface if we add our owns? etc. Thanks. Dmitry. On Wed, Feb 11, 2015 at 10:08 AM, Joe Watkins wrote: > 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 >>> >> >> > --001a11c20e52635882050ecaeb4e--