Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76516 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65828 invoked from network); 14 Aug 2014 12:42:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Aug 2014 12:42:57 -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.179 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.179 mail-we0-f179.google.com Received: from [74.125.82.179] ([74.125.82.179:55089] helo=mail-we0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 23/F3-40673-0DEACE35 for ; Thu, 14 Aug 2014 08:42:57 -0400 Received: by mail-we0-f179.google.com with SMTP id u57so1031518wes.38 for ; Thu, 14 Aug 2014 05:42:52 -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=rqjKFBze1uSEHcR/KAJhPsZ7Lcu4tF5ELoUfYiADTYo=; b=qQC/H+wjblSOtXU6m+9avBJN4IcK+DRCofiQv7NqZS08NDo68/B77iOQf+U2TTCe52 EeEGzIzMUDEffdpup/Fn0bNH06kGUjAG/b0WhUtAfUS/YqSwC9fypF1QbA9rgGQ+IBlZ /B3JF+DB/LFTnQ2YDP7Xew6aoJW3IFWCb/qmjdFOzNYY7EHjzciiFhesPzioLvVlnEiv GC3CIGBKX+2/RwIKznI53nvmzk6+KTx/ap34UoHWAV/7JzuiMI2buuLx7uINajpCciEF F3YMJ6oO3H3IbujcKSLei1ICIxEZbOGOvXniZ0WkO3RfTaZszckEWXsc8MeeTNMAbV78 2eRQ== X-Received: by 10.194.59.18 with SMTP id v18mr11305637wjq.64.1408020172574; Thu, 14 Aug 2014 05:42:52 -0700 (PDT) Received: from [192.168.0.177] ([62.189.198.114]) by mx.google.com with ESMTPSA id td10sm79241065wic.10.2014.08.14.05.42.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 14 Aug 2014 05:42:51 -0700 (PDT) Message-ID: <53ECAECA.50900@gmail.com> Date: Thu, 14 Aug 2014 13:42:50 +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: PHP Internals References: <5DCAA9AE-CC08-48BA-A0D4-78818BD5D656@gmail.com> <53EC8D31.10807@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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): > It may be possible to interpret the argument, but I think it will need > new OPCodes, like ZEND_NEW_WITH_CTOR and ZEND_NEW_WITHOUT_CTOR , and a > compiler patch to support those. > This may be thought for PHP7, and I think will benefit from the > ast-compiler RFC if its voted. Yeah, to clarify, I was definitely thinking in terms of PHP7, where lots is already being done for consistency and parser changes. It may be naive of me, but would it be possible to simply add an implicit constructor with an empty argument list and body to any class which doesn't have one? Because that's kind of what seems logical from the user point of view: class A { } == class A { public function __construct() {} } The same could also be achieved by having an implicit ancestor of all objects, because an empty constructor (and destructor) could be defined there, then over-ridden by whatever the user declares. -- Rowan Collins [IMSoP]