Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78970 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58796 invoked from network); 18 Nov 2014 23:16:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Nov 2014 23:16:33 -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 74.125.82.44 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.44 mail-wg0-f44.google.com Received: from [74.125.82.44] ([74.125.82.44:59479] helo=mail-wg0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 10/E9-06737-053DB645 for ; Tue, 18 Nov 2014 18:16:32 -0500 Received: by mail-wg0-f44.google.com with SMTP id b13so2644589wgh.31 for ; Tue, 18 Nov 2014 15:16:28 -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=FalC5H4SQ6ED76AqMbqubr0TOwNqdN4gJ2YnNRQry18=; b=kHTTeI++FSwpjCReFX90my6sWxZqcKQ3O59dl8xTjjSWepuxgGHvmbLzUcHEnd9ckg HjpIzULnhpx6HFKCny3Aa2viHYRjQKGdthTLFcQTojIhsjpTpGe9fu/c1FihKz7y+Pxo PJ5YinWXM6qIirdlaOzcKYinHwvcJReJjp5GpKyCYSk/nwf9eSYIuN75ksECiXJzcssG 2zcaaGGJI8vQZG9bUDSylbaRjWalFbPCgNG8Sl9ewSdLXn65+xLFHtjQb9Jck6kAgGb7 NvzDT2NXatOtu+Z1HNz+x80WzlO5Ra7Z2ivOum3K5XR6v87O0KEQCqehuXAUBBOspMvg HwsQ== X-Received: by 10.180.74.68 with SMTP id r4mr13863764wiv.33.1416352588679; Tue, 18 Nov 2014 15:16:28 -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 w10sm57653155wje.10.2014.11.18.15.16.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Nov 2014 15:16:28 -0800 (PST) Message-ID: <546BD33A.9030400@gmail.com> Date: Tue, 18 Nov 2014 23:16:10 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: internals@lists.php.net References: <546B0F62.1090705@gmail.com> <546B95F2.2050504@gmail.com> <546BBF4F.8040806@gmail.com> <919EDD0D-F0F4-430A-A84B-96A32DF45E7B@ajf.me> <546BCE21.7080403@gmail.com> <40CBCA4F-5FBE-4687-9DD3-E74F5F7EFD97@ajf.me> <546BD142.5090507@gmail.com> In-Reply-To: <546BD142.5090507@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Default constructors From: rowan.collins@gmail.com (Rowan Collins) On 18/11/2014 23:07, Stanislav Malyshev wrote: > Hi! > >> Are you sure it was intended to work this way, with the parameters >> not being evaluated at all? > Of course, just look at how ZEND_NEW opcode is written. It's the only > reason in has op2 there. That code is not a typo, it's intended to skip > the function call. I don't know the innards of the engine well enough to follow this, but it sounds like you're talking about skipping the evaluation of __construct() as a method if it doesn't exist as one, which is perfectly reasonable. However, the side effect that the *arguments* to that function call are not executed is surely an unintended side-effect of this, which was considered not important enough to worry about. > I personally am not completely sure it's worth the trouble - since, > again, no sane code should ever rely on something like this - but maybe > I'm wrong that there's a valid use case for this. Sorry, I'm not sure what you are referring to by "this" here. To quote an earlier example: $b = 0; $a = new Foo(++$b); Looks like pretty normal code to me; no reason to expect anything about the way class Foo is defined to affect its behaviour. No sane code should rely on that *not* incrementing $b, surely? -- Rowan Collins [IMSoP]