Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99779 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99060 invoked from network); 5 Jul 2017 23:12:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jul 2017 23:12:44 -0000 X-Host-Fingerprint: 95.144.152.253 unknown Received: from [95.144.152.253] ([95.144.152.253:21573] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 26/53-15131-B627D595 for ; Wed, 05 Jul 2017 19:12:43 -0400 Message-ID: <26.53.15131.B627D595@pb1.pair.com> To: internals@lists.php.net References: <827b77ce-f2b7-930a-34cb-ce11ebc2d531@php.net> Date: Thu, 6 Jul 2017 00:12:40 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:49.0) Gecko/20100101 Firefox/49.0 SeaMonkey/2.46 MIME-Version: 1.0 In-Reply-To: <827b77ce-f2b7-930a-34cb-ce11ebc2d531@php.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 95.144.152.253 Subject: Re: OBJECT_OPERATOR vs. DOUBLE_COLON From: ajf@ajf.me (Andrea Faulds) Hi Sebastian, Sebastian Bergmann wrote: > Is it intentional that the DOUBLE_COLON operator can be used on a > variable that contains a reference to an object? I assume so. It wouldn't be the only place that accepts either a class name or an object of that class. > I think that using :: on a variable that contains an object should not > "fall back" to a static access on the object's class. Instead the > runtime should error out. > > What do you think? I would oppose this; I think it would make PHP less consistent, and as Rowan noted, it's useful for accessing constants of the appropriate class associated to an object. Thanks! -- Andrea Faulds https://ajf.me/