Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67100 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92070 invoked from network); 19 Apr 2013 14:10:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Apr 2013 14:10:03 -0000 Authentication-Results: pb1.pair.com smtp.mail=rstoll@tutteli.ch; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rstoll@tutteli.ch; sender-id=pass Received-SPF: pass (pb1.pair.com: domain tutteli.ch designates 80.74.154.78 as permitted sender) X-PHP-List-Original-Sender: rstoll@tutteli.ch X-Host-Fingerprint: 80.74.154.78 ns73.kreativmedia.ch Linux 2.6 Received: from [80.74.154.78] ([80.74.154.78:43780] helo=hyperion.kreativmedia.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F8/03-00022-83051715 for ; Fri, 19 Apr 2013 10:10:01 -0400 Received: (qmail 715 invoked from network); 19 Apr 2013 16:09:57 +0200 Received: from ip-31-205-11-203.ask4internet.com (HELO RoLaptop) (31.205.11.203) by ns73.kreativmedia.ch with (AES128-SHA encrypted) SMTP; 19 Apr 2013 16:09:57 +0200 To: "'Christoph Rosse'" , References: <5170E1F8.9060203@sugarcrm.com> <51714B15.9060401@2bepublished.at> In-Reply-To: <51714B15.9060401@2bepublished.at> Date: Fri, 19 Apr 2013 15:09:54 +0100 Message-ID: <002c01ce3d07$913ccf30$b3b66d90$@tutteli.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQDR4e9hShiwSV6EU2x2O0YxHqUWAwGMYeDeAX8ZE0eave9BcA== Content-Language: de-ch Subject: AW: [PHP-DEV] Importing namespaced functions From: rstoll@tutteli.ch ("Robert Stoll") You can import a namespace and use an alias. For instance use com\example\cms as c; c\foo(); -----Urspr=FCngliche Nachricht----- Von: Christoph Rosse [mailto:crosse@2bepublished.at]=20 Gesendet: Freitag, 19. April 2013 14:48 An: internals@lists.php.net Betreff: Re: [PHP-DEV] Importing namespaced functions On 19.04.2013 08:19, Stas Malyshev wrote: > Hi! > >> One of the shortcomings of namespaced functions in PHP is that it is=20 >> not possible to import them as you can do with classes and=20 >> namespaces. For code that is not in the same namespace as the=20 >> function, you must always reference at least one part of the=20 >> namespace in order to call it. > > What's wrong with referencing one part of it? It can be as short as=20 > two characters, and an an added bonus you won't suddenly have your=20 > strlen overridden by somebody without you knowing it. Functions live=20 > in global space, and there's a real lot of them, that's why importing=20 > them wasn't considered a good idea - it's going back to the same=20 > problem we were escaping with namespaces. > > Saving two keystrokes while sacrificing clarity is usually not the=20 > best idea. > I don't know about your libraries but mine use longer namespace parts = then 2 charakters. And strlen wouldn't be "suddenly" overridden because you would have to explicitly import it, so this argument could be used for namespaces too because if I "use some\ns\DateTime" DateTime is "suddenly" overridden. -- Christoph Rosse Softwaredevelopment | Operations ________________________________________ 2bePUBLISHED Internet Services Austria GmbH Br=FCnner Stra=DFe 85/2, = 1210 Wien Tel.: 0043.1.9971500 Fax.: 0043.1.997150066 E-mail: crosse@2bepublished.at Skype: christoph.rosse Home: http://www.2bepublished.at -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, = visit: http://www.php.net/unsub.php