Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97831 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41929 invoked from network); 17 Jan 2017 20:52:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jan 2017 20:52:48 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 212.232.25.162 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 212.232.25.162 mx206.easyname.com Received: from [212.232.25.162] ([212.232.25.162:55951] helo=mx206.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/EC-00729-F148E785 for ; Tue, 17 Jan 2017 15:52:48 -0500 Received: from cable-81-173-135-7.netcologne.de ([81.173.135.7] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1cTakE-00006K-Lg; Tue, 17 Jan 2017 20:52:44 +0000 Reply-To: internals@lists.php.net References: To: Nikita Popov Cc: PHP Internals Message-ID: Date: Tue, 17 Jan 2017 21:52:40 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] [RFC][DISCUSSION] - Disallow Multiple Constructor Calls From: php@fleshgrinder.com (Fleshgrinder) On 1/17/2017 9:48 PM, Nikita Popov wrote: > Without putting a lot of though into this, the restriction sounds > reasonable. > > However, it is not immediately clear to me how this can be implemented > without adding a disproportionate amount of overhead for something which I > would consider a rather minor feature. If an object only had a single > constructor this would be a simple flag, but if you want to allow one call > per each constructor in the hierarchy (i.e. you can call the constructor > and each parent constructor once), this information needs to be stored > somehow. The obvious way would be a hashset containing the constructors (or > CEs) that have been called on the object, but I don't think this would be > acceptable. > > Regards, > Nikita > Hey Nikic! Thanks for skimming over it. I also though about implementation already. My initial though was -- especially to keep it simple -- to simply delete the method from the object's table. Not sure if this is possible or just introduced more problems than it solves. Also considering that we think reflection should continue to allow calling it multiple times, though this is obviously still debatable. -- Richard "Fleshgrinder" Fussenegger