Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25118 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36951 invoked by uid 1010); 2 Aug 2006 12:43:05 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 36936 invoked from network); 2 Aug 2006 12:43:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Aug 2006 12:43:05 -0000 X-PHP-List-Original-Sender: zeev@zend.com X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from ([80.74.107.235:18691] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id D0/4E-45114-6DD90D44 for ; Wed, 02 Aug 2006 08:43:04 -0400 Received: (qmail 15651 invoked from network); 2 Aug 2006 12:41:56 -0000 Received: from localhost (HELO zeev-notebook.zend.com) (127.0.0.1) by localhost with SMTP; 2 Aug 2006 12:41:56 -0000 Message-ID: <7.0.1.0.2.20060802153423.0d046278@zend.com> X-Mailer: QUALCOMM Windows Eudora Version 7.0.1.0 Date: Wed, 02 Aug 2006 15:43:00 +0300 To: Lukas Smith Cc: internals@lists.php.net In-Reply-To: <16.85.45114.FF370D44@pb1.pair.com> References: <18810497049.20060801234124@marcus-boerger.de> <1154478748.6599.16.camel@blobule> <16.85.45114.FF370D44@pb1.pair.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] RfC: rethink OO inheritance strictness From: zeev@zend.com (Zeev Suraski) At 12:44 02/08/2006, Lukas Smith wrote: >Derick Rethans wrote: > >>On Wed, 2 Aug 2006, Lukas Smith wrote: >> >>>again i feel that people who want to use PHP as a "proper" OO language will >>>definately benefit from a strict mode if they are willing to put >>>in the extra >>>planning. however alienating the userbase for this by making it >>>impossible to >>>keep the old low planning OO style would be a bad idea. >>So then the only option is to introduce a >>"i-dont-want-to-care-about-oo-in-my-classes-mode" for the people >>who simply don't care. > >yes .. it should be possible to set this on a per class basis. and >children should be able to change the mode. classes in lax mode >might also return false unless the classes match exactly. I actually think this can be on a per method basis, so that methods where it's strictly required (such as certain magic method as Marcus said) will be able to set it, without affecting the entire class. It's at the method level that the developer knows whether overriding methods must adhere to the same signature. My recommendation: - 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 - Consider adding userland ability to set entire classes or methods as strict Most people who use 'strict OO' will have E_STRICT enabled and have their code E_STRICT clean, so providing userland support for tagging classes/methods as strict is probably not really necessary. Zeev