Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41968 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86113 invoked from network); 17 Nov 2008 10:58:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2008 10:58:20 -0000 Authentication-Results: pb1.pair.com smtp.mail=david@grudl.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=david@grudl.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain grudl.com from 74.125.78.24 cause and error) X-PHP-List-Original-Sender: david@grudl.com X-Host-Fingerprint: 74.125.78.24 ey-out-2122.google.com Received: from [74.125.78.24] ([74.125.78.24:16426] helo=ey-out-2122.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C1/B0-17095-B4E41294 for ; Mon, 17 Nov 2008 05:58:19 -0500 Received: by ey-out-2122.google.com with SMTP id 5so839667eyj.59 for ; Mon, 17 Nov 2008 02:58:15 -0800 (PST) Received: by 10.102.247.4 with SMTP id u4mr1204658muh.104.1226919495305; Mon, 17 Nov 2008 02:58:15 -0800 (PST) Received: from ?192.168.1.23? ([77.240.188.66]) by mx.google.com with ESMTPS id g1sm10483811muf.8.2008.11.17.02.58.12 (version=SSLv3 cipher=RC4-MD5); Mon, 17 Nov 2008 02:58:14 -0800 (PST) Message-ID: <49214E2E.60502@grudl.com> Date: Mon, 17 Nov 2008 11:57:50 +0100 User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: PHP internals Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit Subject: [PHP-DEV] Re: Namespace resolution rules has been changed? From: david@grudl.com (David Grudl) Try to answer the question: what is the $obj instance of? namespace foo; $obj = $factory->loadClass('bar\class'); ------- $factory is implemented cca this way: namespace ?; class Factory { function loadClass($class) { return new $class; } } With absolute FQN is the answer evident. With relative FQN it is very esoteric. With relative FQN developers will have to implement "save" loadClass() this way: function loadClass($class) { if (strpos($class, '\\') !== FALSE && strncmp($class, '\\', 1)) { $class = '\\' . $class; } return new $class; } OMG David Grudl