Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68875 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21331 invoked from network); 2 Sep 2013 22:18:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2013 22:18:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 108.166.43.115 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 108.166.43.115 smtp115.ord1c.emailsrvr.com Linux 2.6 Received: from [108.166.43.115] ([108.166.43.115:42686] helo=smtp115.ord1c.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 09/A1-29856-1AE05225 for ; Mon, 02 Sep 2013 18:18:09 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp7.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id 310E91B82CA; Mon, 2 Sep 2013 18:18:07 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp7.relay.ord1c.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id B8C581B825F; Mon, 2 Sep 2013 18:18:06 -0400 (EDT) Message-ID: <52250E8F.5010805@sugarcrm.com> Date: Mon, 02 Sep 2013 15:17:51 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Anthony Ferrara CC: Nicolas Grekas , "internals@lists.php.net" References: <5220D212.3010101@sugarcrm.com> <61FCD6C4A31248078FEAD2BA73D7CD44@gmail.com> <7AF31CC1D1554454AC95AE758D23E92E@gmail.com> <52243F6C.7070806@sugarcrm.com> <5224EEEF.3070204@sugarcrm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Function autoloading From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > So what your saying, if I understand you correctly, is that PHP was > intentionally designed to be non-deterministic? And it was designed that > way to save a single character? It is deterministic, there are rules for it, described in http://us1.php.net/manual/en/language.namespaces.fallback.php. And it's not to save single character, it is to save single character on hundreds of thousands of function calls which otherwise all would have to be rewritten. It's to prevent namespacing a code piece being equal to rewriting every function call in it and making it extremely ugly on the way. The cost of if is that yes, if you want to override strlen (which still escapes me why would you ever want to do something like that) you need to load it first so the engine knows about it and resolves it correctly. I think it is a very small cost compared to rewriting and uglifying all your code. It was all extensively and meticulously discussed on the list when namespaces were designed. It is a real waste of time to repeat those discussions now. > It's only "try namespace, then global" in the case where there's no `\` > in the function name. Compile code that does the > check: http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_compile.c#1938 I know. That you for pointing me to the code I wrote. I am sorry that I didn't just copy-paste the whole "namespace resolution rules" section, I though it is clear from the context that I am talking about non-fully-qualified names. > PS: I think it's ironic talking about internal consistency of a language > in the same reply where you justify "try namespace, then global" as a > good design feature. Just pointing that out... It is a good design feature, and there are very good reasons for it. Unless, of course, you think prepending every internal function and PHP constant in all the existing code in PHP with \ would be better. In which case we have very different ideas about what good design is and would never come to any agreement on that. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227