Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89006 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19876 invoked from network); 29 Oct 2015 18:41:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Oct 2015 18:41:12 -0000 X-Host-Fingerprint: 176.25.179.123 unknown Received: from [176.25.179.123] ([176.25.179.123:21061] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E3/B0-16245-74862365 for ; Thu, 29 Oct 2015 13:41:12 -0500 Message-ID: To: internals@lists.php.net References: Date: Thu, 29 Oct 2015 18:41:06 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:41.0) Gecko/20100101 Firefox/41.0 SeaMonkey/2.38 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 176.25.179.123 Subject: Re: Support execution scope realization at runtime (or last pieces forprivate class support) From: ajf@ajf.me (Andrea Faulds) Hi Guilherme, guilhermeblanco@gmail.com wrote: > Currently, there's no way to determine at runtime what is the scope of the > execution. This means you can't resolve if the current instruction is > happening on a top-level scope, in a class definition, namespace, function > or method. > > Together with this (maybe even more importantly), there's no way to resolve > namespaces in any way, since they only exist up to compile time (they > become part of class name through string append), and no real data > structure around it exists. I was forced to create a weird string check to > make it work... =( Making plain string literals in function calls be interpreted differently depending on context does not sound like a good idea to me. Functions shouldn't rely on hidden (non-syntactically-obvious) contextual information; I think func_get_args() et al. were a mistake. I'm not sure why we'd need to resolve namespaces at runtime anyway. If you just need to pass the name of a class to a function, we have ::class. Is there some use-case I'm unaware of? Thanks. -- Andrea Faulds http://ajf.me/