Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80707 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6594 invoked from network); 17 Jan 2015 19:40:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jan 2015 19:40:15 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.171 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.212.171 mail-wi0-f171.google.com Received: from [209.85.212.171] ([209.85.212.171:48984] helo=mail-wi0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F9/60-04095-E9ABAB45 for ; Sat, 17 Jan 2015 14:40:14 -0500 Received: by mail-wi0-f171.google.com with SMTP id l15so112096wiw.4 for ; Sat, 17 Jan 2015 11:40:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=xBBq/yADtdfluA9RfpjdyuK2trMG2TcUtZo5Xl+7Rh4=; b=vqqzCTZqWX1kX5qlXgyTeiOlE6uQLyfqPQEq3MCqrx0Xz5YJArg2TACBJbPKSAutMk 1YjFWMVgCJSzHcHM0I27RpTL6fJZVZU2C9Te79NqBFgD7SteyKQE93iRIckFtLeF9LqR AYkw/UK+TwbP2rYL2NBcDjgE4Eb2uGdL6OjTk0QttSpX+U5iF2Eg2D2MfvZuwVK6pb6w dsR2kCBpyTrG0KB9A181nmmfR9hZyY4KRh0fEKCdAb7gi+gXsNCyvxQzjNeYLXhvFQF0 c0pCWAZEbUHk+PacP4XSD1f5gcYTydPCM36bDezx6tYMh+NcvykYAHbxKEb7Q4W9HN2n rT7g== X-Received: by 10.194.84.240 with SMTP id c16mr42584141wjz.74.1421523611583; Sat, 17 Jan 2015 11:40:11 -0800 (PST) Received: from [192.168.0.2] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by mx.google.com with ESMTPSA id cm7sm7782605wib.6.2015.01.17.11.40.10 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Jan 2015 11:40:10 -0800 (PST) Message-ID: <54BABA93.9070809@gmail.com> Date: Sat, 17 Jan 2015 19:40:03 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: internals@lists.php.net References: <0DD30A0D-E7CA-4150-83E0-8FD46635279C@ajf.me> <8761c6280g.fsf@margaine.com> <54B91D16.70901@gmail.com> <78.22.47555.7C24AB45@pb1.pair.com> <1421519637.40188.1.camel@proposaltech.com> In-Reply-To: <1421519637.40188.1.camel@proposaltech.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Remove PHP 4 Constructors From: rowan.collins@gmail.com (Rowan Collins) On 17/01/2015 18:33, Todd Ruth wrote: >> As already mentioned I think as an end result we shouldn't have two >> >ways to define constructors. Given that PHP already prefers the >> >new-style constructors I've proposed that we work towards dropping the >> >old-style, it's just down to a matter of how. > I've been following these threads for about 10 years and beg that php > internals continues to "live and let live". > There have been many, many threads over the years from what I would call > (with obvious bias) "OO fundamentalists". They seem to be at war with > code that is "bad form". This is an argument that comes up a lot, and it has some merit, sometimes. I don't think using __construct over named-method for constructors really has anything to do with "OOP fundamentalism"; it was a design change to make certain things simpler (like parent::__construct), and more consistent (all reserved magic methods begin with __, so any method not beginning with that is safe to use however you like). > In the global cost/benefit analysis I don't see that the > benefits of purifying OO outweigh the costs. Not everything is a matter of code style - supporting legacy features comes at a cost in complexity, and sometimes even performance. Whenever new features are added - such as the ability to call parent::__construct when the parent doesn't declare a constructor explicitly - decisions have to be made on how they interact with old features - such as PHP4-style constructors. And simply by having an accumulation of old features, the codebase is larger, harder to understand, harder to change, and has more surface area for bugs. Deprecating a feature or raising an E_STRICT doesn't, of course, reduce this complexity by itself - indeed, it slightly increases it - but it paves the way for a future version to decide that this feature is no longer supported, and can be removed in order to improve the rest of the engine. So, you are quite right to highlight the costs of doing this, and they may well outweigh the benefits in this case. However, you are wrong to assume that the only benefit to be weighed is "purifying OO". Regards, -- Rowan Collins [IMSoP]