Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:79049 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14479 invoked from network); 20 Nov 2014 19:05:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Nov 2014 19:05:40 -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 74.125.82.51 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.51 mail-wg0-f51.google.com Received: from [74.125.82.51] ([74.125.82.51:32785] helo=mail-wg0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 79/21-07686-38B3E645 for ; Thu, 20 Nov 2014 14:05:39 -0500 Received: by mail-wg0-f51.google.com with SMTP id k14so4526057wgh.24 for ; Thu, 20 Nov 2014 11:05:36 -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=9+LCTyNvVyT79hfiaDk51o5H8p6FHLg7px0A6fEfAR8=; b=Uxco/3mHAc0+mqVNlG04bmgVghveYiO4wld++qqSv1CDXu0VX83SveAdAlmJp9UrUC itRP0szGE5WtS5ki9MtiTvf1V6yJLNWdKHm5imS38AAfyRktnGBrt4x2B3IyZXPaOQBA 7e4MUMEeIwj70SJAnk0YH5JGzw7on7HFP+Mi5U5ahJPLDSNmvzBxGKoYHMgBY5po8uzb uV2Ctx0nq4MFOcGPByAdNYdTZQG7bkCBGSQ2XaluPPO97Z8tsP3yLwdsDeGNKMsM+0Zk NjbQZwHTrdOChcRGAqCxz3GJnldVY1h/hRbxMJkwKP+krlNirzjasT2Xpf9IKvXg9cbh +grw== X-Received: by 10.180.82.227 with SMTP id l3mr6907219wiy.0.1416510336410; Thu, 20 Nov 2014 11:05:36 -0800 (PST) Received: from [192.168.0.148] ([62.189.198.114]) by mx.google.com with ESMTPSA id p8sm702764wia.1.2014.11.20.11.05.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Nov 2014 11:05:35 -0800 (PST) Message-ID: <546E3B71.3000905@gmail.com> Date: Thu, 20 Nov 2014 19:05:21 +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: PHP Internals List References: <546B0F62.1090705@gmail.com> <546B95F2.2050504@gmail.com> <546BBF4F.8040806@gmail.com> <919EDD0D-F0F4-430A-A84B-96A32DF45E7B@ajf.me> <546BCE21.7080403@gmail.com> <546BD0E8.6020609@gmail.com> <546BD206.9040800@gmail.com> <546BD451.4070909@gmail.com> <546BDEAE.2010102@gmail.com> <546BF769.9090408@gmail.com> <6120240B-1493-4805-90FF-C0EE38795B89@gmail.com> <546D3968.8040702@gmail.com> <546DB62F.7060200@gmail.com> <546E374E.8050606@gmail.com> In-Reply-To: <546E374E.8050606@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Default constructors From: rowan.collins@gmail.com (Rowan Collins) Stanislav Malyshev wrote on 20/11/2014 18:47: > I do not think the standard should require it, as whoever using this for > anything, one way or another, is doing it very, very wrong, but that's > how it works now. As I said before, I don't see anything "very, very wrong" about assuming that this code will increment $b, and run function bar(): $foo = new Foo(++$b); $foo = new Foo( bar() ); The fact that I need to know the internals of class Foo to know whether it will is pretty weird in a language which has no other lazy evaluation. If it was the fact the constructor had insufficient parameters that triggered the laziness, it would be less surprising; but adding a constructor with no parameters, and an empty body, causes the expression to be evaluated, even though its result is still thrown away, and the public API of class Foo is identical. Intentional or not, I think this is undesirable behaviour, and if it can be changed without too much difficulty, it should be. -- Rowan Collins [IMSoP]