Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25193 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69409 invoked by uid 1010); 4 Aug 2006 07:25:29 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 69394 invoked from network); 4 Aug 2006 07:25:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Aug 2006 07:25:29 -0000 X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.94.239.5 jdi.jdi-ict.nl Linux 2.5 (sometimes 2.4) (4) Received: from ([82.94.239.5:50526] helo=jdi.jdi-ict.nl) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id 32/20-63329-766F2D44 for ; Fri, 04 Aug 2006 03:25:29 -0400 Received: from localhost (localhost [127.0.0.1]) by jdi.jdi-ict.nl (8.13.6/8.12.11) with ESMTP id k747PNMQ024057; Fri, 4 Aug 2006 09:25:23 +0200 Date: Fri, 4 Aug 2006 09:23:57 +0200 (CEST) X-X-Sender: derick@localhost To: Rasmus Lerdorf cc: PHP Developers Mailing List In-Reply-To: <44D1FAF0.5060906@lerdorf.com> Message-ID: References: <18810497049.20060801234124@marcus-boerger.de> <44CFDB2B.1010907@cschneid.com> <20060802010156.5be0258c@pierre-u64> <44CFDF89.6010506@lerdorf.com> <7.0.1.0.2.20060802153119.0c2193c0@zend.com> <44D0DB82.1070307@lerdorf.com> <44D1FAF0.5060906@lerdorf.com> X-Face: "L'&?Ah3MYF@FB4hU'XhNhLB]222(Lbr2Y@F:GE[OO;"F5p>qtFBl|yVVA&D{A(g3[C}mG:199P+5C'v.M/u@Z\![0b:Mv.[l6[uWl' MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] RfC: rethink OO inheritance strictness From: derick@php.net (Derick Rethans) On Thu, 3 Aug 2006, Rasmus Lerdorf wrote: > Pierre wrote: > > > > On 8/3/06, Derick Rethans wrote: > > > > > > In this particular case I think it should be possible to mark > > > certain internal > > > > methods as strict and keep userspace methods loose. > > > > > > But I would like to see atleast an e_strict warning of signatures are > > > violated to give atleast the options to be strict and get warnings for > > > it. I am pretty sure Edin doesn't give a **** about e_strict warnings... > > > so that will work fine. I think that Zeev suggested something like this. > > > > For what I understand (and agree), he meant the other way 'round. > > Users who like strictness will have to use an extra keyword in the > > declaration. Users who don't care will not have to change anything in > > their (working) code. > > I'm not all that keen on a new keyword for this. How about using an interface > to indicate strictness? Isn't this really what interfaces are all about? There is however a problem with this approach: You would still need to modify code in order to get things "strict". Take for example some code that I have running (and want to keep running) on PHP 5.1. If in 5.2 we suddendly need to implement a specific interface in order to get strict behavior this code will no longer run on PHP 5.1 (without hacks). The other option is not to mark things as strict but that can makes things a bitch to debug. However, if we follow Zeev's proposal then there are no real problems at all - technical wise. Only having to ignore E_STRICT in case your apps are violating some core OO rules is then necessary. Splitting out E_STRICT into different error levels might work as well, but I am not so sure if that is necessary. So let me sum up the things from Zeev's proposal) and dropping his 4th point from it. - Add a new flag to methods (at the implementation level) that will allow to flag them as 'strict' - In case such a strict method is improperly overridden - error out (E_ERROR) - In case a non-strict method is improperly overridden - emit E_STRICT I think this is perfectly acceptable as it address both the people who want strictess, without having to change any code, and the people who do not care about it, which can simply ignore E_STRICT then. regards, Derick