Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61735 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52290 invoked from network); 25 Jul 2012 05:22:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jul 2012 05:22:55 -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 67.192.241.153 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.153 smtp153.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.153] ([67.192.241.153:58495] helo=smtp153.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BA/D9-27263-EA28F005 for ; Wed, 25 Jul 2012 01:22:54 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp25.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id F3F442D016C; Wed, 25 Jul 2012 01:22:51 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp25.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id A6F312D0114; Wed, 25 Jul 2012 01:22:51 -0400 (EDT) Message-ID: <500F82AB.30508@sugarcrm.com> Date: Tue, 24 Jul 2012 22:22:51 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Reeze Xia CC: PHP Internals References: <933A547D13294D10A802336D74E42DFE@gmail.com> <500EEA67.8060100@sugarcrm.com> <76992170DA45492DAD9EFFEBC4F791B9@gmail.com> In-Reply-To: <76992170DA45492DAD9EFFEBC4F791B9@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: =?UTF-8?B?5Zue5aSN77yaIFtQSFAtREVWXSBbUkZDXSBQcm9wb3NhbCBuYW0=?= =?UTF-8?B?ZXNwYWNlIGltcG9ydGluZyB3aXRoIGZyb20gc3ludGF4?= From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > No, we can not import namespace directly for now : Of course you can. You just missing on what namespace import means in PHP, it's not like Java (though a bit like Python). > namespace A { > class B {} > } > > namespace { > use A; > > var_dump(new B()); > } use A is a no-op, just as the warnings tell you. You can just write A\B. It's only 2 characters more. If your A is longer, then you can alias it to something shorter. > and if we need alias we could: > // reduce > use GlobalNamespace\SubSpace\ThirdSpace\Class1; > use GlobalNamespace\SubSpace\ThirdSpace\Class2 as Alias2; > use GlobalNamespace\SubSpace\ThirdSpace\ForthSpace\Class3 as Alias3; You could just do use GlobalNamespace\SubSpace\ThirdSpace as Spc; $a = new Spc\Class1(); -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227