Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80742 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98600 invoked from network); 18 Jan 2015 15:24:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jan 2015 15:24:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.175 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.217.175 mail-lb0-f175.google.com Received: from [209.85.217.175] ([209.85.217.175:49054] helo=mail-lb0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 48/1D-18613-130DBB45 for ; Sun, 18 Jan 2015 10:24:33 -0500 Received: by mail-lb0-f175.google.com with SMTP id z11so24696343lbi.6 for ; Sun, 18 Jan 2015 07:24:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=MjSc3XKqPfG48I9WXNlzFLoTXSb/pUWn1b2RJ344jdE=; b=UF96c3slLzXRMGEiM5QqMxKinCETlYbEclRAT2/Lm3WBwbL1znCee5ljDAKN405fMo 1b2f8glK0pRTQeo/WfvoQWxXK+GS0+9NtU4PmdFOT1Zl92oVt6zYg6TD1ol1cqt5myqy SpZnO50Wxl3PtIiajBAwYpV2zNsZUngrFcRe9pLUPAe7peQhPvkvFwi2UYIMH5HtQwFh K2FXtSrw5CwtBCYQ85m8fSvifnh3V+yzrbD9mgcYfiXmEZ8x6wvuNczV6YXTbqe5WSgk XTaP+Byz+RDzBSMxUJDKM+WGxZcqgAWqp6nYbpqckWF7ViPCrT12ZhfdUrRYU+1fvd5v 5Wzg== MIME-Version: 1.0 X-Received: by 10.152.3.70 with SMTP id a6mr7712333laa.71.1421594670064; Sun, 18 Jan 2015 07:24:30 -0800 (PST) Received: by 10.25.206.144 with HTTP; Sun, 18 Jan 2015 07:24:29 -0800 (PST) In-Reply-To: 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> <54BABA93.9070809@gmail.com> Date: Sun, 18 Jan 2015 15:24:29 +0000 Message-ID: To: Tony Marston Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e014940a852eb89050ceecd48 Subject: Re: [PHP-DEV] [RFC] Remove PHP 4 Constructors From: rowan.collins@gmail.com (Rowan Collins) --089e014940a852eb89050ceecd48 Content-Type: text/plain; charset=UTF-8 On 18 January 2015 at 12:23, Tony Marston wrote: > "Rowan Collins" wrote in message news:54BABA93.9070809@gmail.com... > >> >> 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), >> > > This problem is partly solved in the RFC for Default Constructors (see > https://wiki.php.net/rfc/default_ctor). If this were extended to cope with > PHP 4 style constructors as well then all the problems would be solved. > Then > there would be no need to remove PHP 4 constructors at all. > > That's a good example of supporting old features adding complexity. You're right, it could solve this problem, at the expense of extra code, with extra possibility of bugs. > 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, >> > > All compilers are complex beasts - that is the nature of compilers. If you > cannot handle that complexity you shouldn't be working on a compiler. Saying that something is complex in no way justifies making it more complex; arguably, quite the opposite: compilers (and runtime engines) are complex enough at the best of times, so features which add to that complexity should be carefully evaluated to avoid the whole thing becoming an unmaintainable mess. > > > 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. >> > > Removing long-standing features for no good reason (and a change in style > is > never a good reason) does nothing more than frustrate all those 240 million > website owners who find that their existing applications will no longer > run. > This is the primary reason why there is a slow adoption rate for each new > release. If you stop breaking the language then the adoption rate will be > quicker. I'm not sure why you've replied with a well-worn argument about "no good reason" to an e-mail whose sole purpose was pointing out a good reason. You may think my reason is not valid, but that doesn't make this paragraph remotely relevant or insightful. > > > 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". >> > > Yet the reasons I have seen for removing an existing feature are rarely to > fix a problem but to make the language "cleaner" or "more consistent". What > this means in reality is "PHP would be cleaner if it didn't contain all > those features that I don't like and I don't use, and I don't want anybody > else to use them either". > Again, you have opted to ignore my point rather than respond to it. I am not saying there is definitely sufficient justification to remove this particular feature, but the idea that PHP could simply continue forever to support every feature it has ever had, with no cost to anyone, and that therefore anyone wanting to remove things is some kind of selfish dictator is patently false. Those proposing changes should certainly justify the benefits, but those opposing should not simply pretend that those benefits cannot exist. Regards, -- Rowan Collins [IMSoP] --089e014940a852eb89050ceecd48--