Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76512 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 54380 invoked from network); 14 Aug 2014 10:19:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2014 10:19: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.52 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.52 mail-wg0-f52.google.com Received: from [74.125.82.52] ([74.125.82.52:40434] helo=mail-wg0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0D/42-40673-93D8CE35 for ; Thu, 14 Aug 2014 06:19:38 -0400 Received: by mail-wg0-f52.google.com with SMTP id a1so848276wgh.11 for ; Thu, 14 Aug 2014 03:19:31 -0700 (PDT) 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=8PCSu+MIa1nGTPAjO5il/hJP7Ndo81Ngv+rVgh1YPtA=; b=UHAcrvOGQSf09h6MccmSPh26rbkKX6q4oNXvYvXSRn13FArMEv2QDLYlr/7/zFhmG1 VDsyani0OgO+Mix0ps2B4t6rlukJ2SSlrpKlLC+c6f/X7NyD8nxRHInyGzMQlCkdyIIU YQ8lcQH3wzzDgQTqZQG0iNySMrrUUporxZyu7R6nUH3/ZGPnvaKFaK06Lc0qlkn1CjrH s1nsf2PQ7N6tK7jud8wfVutEeMA28qAlBdSz5fkNU/iMFdXE6M5uWf+n/hPmrYOVVCMV WtzFNM8Om/EAu/yzoLBPYRGMqah3pvFvqGagYSPYhPrOrGIR40yZ9IYtDdz2CPV8u48U gXIg== X-Received: by 10.194.3.100 with SMTP id b4mr2460278wjb.111.1408011571576; Thu, 14 Aug 2014 03:19:31 -0700 (PDT) Received: from [192.168.0.177] ([62.189.198.114]) by mx.google.com with ESMTPSA id fs3sm18450816wic.20.2014.08.14.03.19.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 14 Aug 2014 03:19:31 -0700 (PDT) Message-ID: <53EC8D31.10807@gmail.com> Date: Thu, 14 Aug 2014 11:19:29 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: internals@lists.php.net References: <5DCAA9AE-CC08-48BA-A0D4-78818BD5D656@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Evaluation of constructor arguments if there's no constructor From: rowan.collins@gmail.com (Rowan Collins) Julien Pauli wrote (on 14/08/2014): > On Thu, Aug 14, 2014 at 8:26 AM, Tjerk Meesters > wrote: >> Hi internals, >> >> I was sifting through the bucket o’ bugs and found these two related issues: >> https://bugs.php.net/bug.php?id=67829 >> https://bugs.php.net/bug.php?id=54162 (closed) >> >> They concern the behaviour of the engine when a class defines no constructor or if the class to be instantiated doesn’t exist, which can be seen here: http://3v4l.org/jOQY0 >> >> This is obviously a design decision, but doesn’t seem to have a mention in the documentation nor the spec (I couldn’t find it under the ‘new’ operator). >> >> I can add a paragraph in the documentation for it; the question is whether it should also be added to the spec, seeing how HHVM and PHP behave differently in this respect? It could be added as implementation dependent behaviour I suppose? > This is a known behavior which is part of the VM. > It is designed at http://lxr.php.net/xref/PHP_5_5/Zend/zend_vm_def.h#3383 > > I guess its an optimisation that prevents the compiler from compiling > a ZEND_DO_FCALL for constructors, which optimizes a bit the VM path > for object construction. > Dmitry should have more informations. > > I'm +1 for a documentation or spec mention. > > > Julien.Pauli > When it came up on StackOverflow chat, it was cheekily dubbed "Rasmus evaluation", because nobody could find any theory matching that particular optimisation: https://chat.stackoverflow.com/transcript/11/2013/9/28/14-17 I'm still not entirely sure it's a good idea, and can't imagine how anyone would rely on it (if you have a look at that trasnscript, you'll find some fun attempts at finding an esoteric use). Is it really that big an optimisation that it's worth such surprising behaviour? -- Rowan Collins [IMSoP]