Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100897 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4467 invoked from network); 14 Oct 2017 01:02:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Oct 2017 01:02:09 -0000 X-Host-Fingerprint: 95.144.122.1 unknown Received: from [95.144.122.1] ([95.144.122.1:27974] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E3/18-07885-D0261E95 for ; Fri, 13 Oct 2017 21:02:08 -0400 Message-ID: To: internals@lists.php.net References: Date: Sat, 14 Oct 2017 02:02:02 +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: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 95.144.122.1 Subject: Re: Suggestion Method Constant From: ajf@ajf.me (Andrea Faulds) Hi Mathias, Mathias Grimm wrote: > I would like to suggest a method constant that could be used the same way > we use the ::class one > > I don't have a strong personal preference but it could be something like: > > MyController::myActionMethod::method, no sure about the internals but it > would be consistent with the one for the class. > > Cheers, > I've long wanted to make constant lookups fall back to a closure of the correspondingly-named function, where one exists. so `strlen` would resolve to a closure of strlen(). Thing is that classes are weird. We sort of have three different things with sometimes-similar syntax: constants, methods and properties. foo::bar is a constant, foo::bar() is a function, $foo->bar() is a function, but $foo->bar is not a constant. So, if I want $foo->bar to resolve to a method, then $foo::$bar should too, even though that makes no sense. The PHP static property syntax is the bane of my existence. -- Andrea Faulds https://ajf.me/