Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78953 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14909 invoked from network); 18 Nov 2014 19:12:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Nov 2014 19:12:22 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.46 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.220.46 mail-pa0-f46.google.com Received: from [209.85.220.46] ([209.85.220.46:43677] helo=mail-pa0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 69/81-06737-51A9B645 for ; Tue, 18 Nov 2014 14:12:21 -0500 Received: by mail-pa0-f46.google.com with SMTP id lj1so931228pab.19 for ; Tue, 18 Nov 2014 11:12:17 -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:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=Bj57nRTALOlSnSjkWH8WEF55V6nyMnMwWfGKgkuI9Js=; b=zWH7YVRKDjej0OiyF9FU4eWiNR5RfC+/eGf1ejBBIfmpd6mUV52hDDinnrY8pZJl2W YAuKV3huxEMrn6Qi4OSZ1u3L0WFHIFzI4C2Va8/J1HJyPPSQ+aXeTRucEvIY3yBRa1PQ uKfn8L/9vOPdLS6b6JiJV37+TC4ivEFPlNHIcMTMD6rRpS8bVLheZV9/Pglu9Peh3FCd 8C5Vh1L1wrpvC1cqC7R/SOEHBpg9cNl20/B1Irm54Ms8tqKJgrT/xSAI0SI0OnrAoq3W KIYVEEKXLtLZSPX+FtTzf8f7ge3DlqI3smamwXWwoTU9t0rZav371LuA4xN0radffQFy uwfg== X-Received: by 10.70.100.170 with SMTP id ez10mr38998831pdb.73.1416337937701; Tue, 18 Nov 2014 11:12:17 -0800 (PST) Received: from [192.168.2.145] (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id th7sm16394874pac.47.2014.11.18.11.12.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Nov 2014 11:12:17 -0800 (PST) Message-ID: <546B9A0F.8060805@gmail.com> Date: Tue, 18 Nov 2014 11:12:15 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: Andrea Faulds CC: Ferenc Kovacs , PHP Internals References: <546B0F62.1090705@gmail.com> <546B9739.6060904@gmail.com> <8C177557-6F67-4A6E-AABB-85B709964FCC@ajf.me> In-Reply-To: <8C177557-6F67-4A6E-AABB-85B709964FCC@ajf.me> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] [RFC] Default constructors From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > mean we should add this, though. Because this RFC means you can just > blindly call the constructor, whether or not it exists, and expect it Yes, that's exactly what it means and it's good, not bad - new() has been doing that for years and nobody complained. > to work. And that is bad: If you don’t know how the parent class > works, you really shouldn’t be extending it. -- Andrea Faulds That sounds just wrong - information hiding is a basic premise of OO, and to extend the object you shouldn't have to know the intimate details of its implementation. In fact, in many cases you can't - such as with internal classes. That's why we have problems with class initilization for extending internal classes - because people are trained "you can't just call the parent ctor, you need to verify things thoroughly first". And that'd exactly wrong. If you know you can create an object without parameters - new Foo() - then you should be able to extend it and call parent::__construct() - which is supposed to do exactly the same. Unfortunately, in PHP - unlike pretty much any other OO language - you can not.