Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82345 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33002 invoked from network); 10 Feb 2015 07:33:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Feb 2015 07:33:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@bof.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=php@bof.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain bof.de designates 80.242.145.70 as permitted sender) X-PHP-List-Original-Sender: php@bof.de X-Host-Fingerprint: 80.242.145.70 mars.intermailgate.com Received: from [80.242.145.70] ([80.242.145.70:46685] helo=mars.intermailgate.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2E/FA-47508-654B9D45 for ; Tue, 10 Feb 2015 02:33:42 -0500 Received: (qmail 25240 invoked by uid 1009); 10 Feb 2015 08:33:39 +0100 Received: from 209.85.216.52 by mars (envelope-from , uid 89) with qmail-scanner-1.25-st-qms (clamdscan: 0.96.2/20051. spamassassin: 3.3.1. perlscan: 1.25-st-qms. Clear:RC:1(209.85.216.52):. Processed in 0.262629 secs); 10 Feb 2015 07:33:39 -0000 X-Antivirus-MYDOMAIN-Mail-From: php@bof.de via mars X-Antivirus-MYDOMAIN: 1.25-st-qms (Clear:RC:1(209.85.216.52):. Processed in 0.262629 secs Process 25224) Received: from mail-qa0-f52.google.com (gmail@bof.de@209.85.216.52) by mars.intermailgate.com with RC4-SHA encrypted SMTP; 10 Feb 2015 08:33:39 +0100 Received: by mail-qa0-f52.google.com with SMTP id v10so10611192qac.11 for ; Mon, 09 Feb 2015 23:33:38 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.140.106.228 with SMTP id e91mr47623225qgf.19.1423553618272; Mon, 09 Feb 2015 23:33:38 -0800 (PST) Received: by 10.140.104.65 with HTTP; Mon, 9 Feb 2015 23:33:38 -0800 (PST) Received: by 10.140.104.65 with HTTP; Mon, 9 Feb 2015 23:33:38 -0800 (PST) In-Reply-To: References: <54D7ED22.3080001@gmail.com> Date: Tue, 10 Feb 2015 08:33:38 +0100 Message-ID: To: Yasuo Ohgaki , internals Cc: Dmitry Stogov Content-Type: multipart/alternative; boundary=001a113a676cbc6aac050eb6e7ea Subject: Re: [PHP-DEV] Design by Contract From: php@bof.de (Patrick Schaaf) --001a113a676cbc6aac050eb6e7ea Content-Type: text/plain; charset=UTF-8 Am 10.02.2015 08:08 schrieb "Yasuo Ohgaki" : > > One reason I would like to use __invariant() is to allow overriding parents. > I think we should have way for it, but I don't have good idea now. > I'm still thinking. Hmm, Idea... Imagine the require keyword, in the context of classes, as an alternative to the function keyword. One could write any of these: class foo { require (expr); // like anonymous function. nonoverridable static require (expr); // same for nonmethod calls // _named_ form require something (expr); // overrides static require otherthing (expr); // overrides } This way selective overriding would be possible for individual conditions. The namespace for these invariant expression names could / should be wholly separate from the method namespace itself. best regards Patrick --001a113a676cbc6aac050eb6e7ea--