Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67099 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89760 invoked from network); 19 Apr 2013 13:48:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Apr 2013 13:48:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=crosse@2bepublished.at; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=crosse@2bepublished.at; sender-id=unknown Received-SPF: error (pb1.pair.com: domain 2bepublished.at from 78.142.132.110 cause and error) X-PHP-List-Original-Sender: crosse@2bepublished.at X-Host-Fingerprint: 78.142.132.110 mgate.danubix.com Linux 2.6 Received: from [78.142.132.110] ([78.142.132.110:33859] helo=mgate.danubix.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7D/92-00022-91B41715 for ; Fri, 19 Apr 2013 09:48:10 -0400 Received: from server3.zimbrahosting.at ([78.142.132.104]) by mgate.danubix.com with esmtp (Exim 4.71) (envelope-from ) id 1UTBfa-0007OV-Eh for internals@lists.php.net; Fri, 19 Apr 2013 15:48:06 +0200 Received: from [192.168.62.62] (unknown [217.116.179.162]) by server3.zimbrahosting.at (Postfix) with ESMTPSA id 4D3BADAC112 for ; Fri, 19 Apr 2013 15:48:06 +0200 (CEST) Message-ID: <51714B15.9060401@2bepublished.at> Date: Fri, 19 Apr 2013 15:48:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: internals@lists.php.net References: <5170E1F8.9060203@sugarcrm.com> In-Reply-To: <5170E1F8.9060203@sugarcrm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Importing namespaced functions From: crosse@2bepublished.at (Christoph Rosse) On 19.04.2013 08:19, Stas Malyshev wrote: > Hi! > >> One of the shortcomings of namespaced functions in PHP is that it is >> not possible to import them as you can do with classes and >> namespaces. For code that is not in the same namespace as the >> function, you must always reference at least one part of the >> namespace in order to call it. > > What's wrong with referencing one part of it? It can be as short as two > characters, and an an added bonus you won't suddenly have your strlen > overridden by somebody without you knowing it. Functions live in global > space, and there's a real lot of them, that's why importing them wasn't > considered a good idea - it's going back to the same problem we were > escaping with namespaces. > > Saving two keystrokes while sacrificing clarity is usually not the best > idea. > I don't know about your libraries but mine use longer namespace parts=20 then 2 charakters. And strlen wouldn't be "suddenly" overridden because you would have to=20 explicitly import it, so this argument could be used for namespaces too=20 because if I "use some\ns\DateTime" DateTime is "suddenly" overridden. --=20 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