Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39029 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39825 invoked from network); 17 Jul 2008 02:36:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2008 02:36:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=greg@chiaraquartet.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=greg@chiaraquartet.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain chiaraquartet.net from 208.83.222.18 cause and error) X-PHP-List-Original-Sender: greg@chiaraquartet.net X-Host-Fingerprint: 208.83.222.18 unknown Linux 2.6 Received: from [208.83.222.18] ([208.83.222.18:56468] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 73/E4-54589-C20BE784 for ; Wed, 16 Jul 2008 22:36:30 -0400 Received: from mail.bluga.net (localhost.localdomain [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id 095DCC0D90A for ; Wed, 16 Jul 2008 19:36:26 -0700 (MST) Received: from [192.168.1.132] (static-64-115-191-41.isp.broadviewnet.net [64.115.191.41]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id 9215CC0D909 for ; Wed, 16 Jul 2008 19:36:25 -0700 (MST) Message-ID: <487EB028.5090201@chiaraquartet.net> Date: Wed, 16 Jul 2008 22:36:24 -0400 User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: php-dev Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: questions about namespaces, functions vs. closures From: greg@chiaraquartet.net (Greg Beaver) Hi, Some questions about namespaces now that PHP 5.3 continues to evolve 1) Do we need functions in namespaces now that we have closures? One of the main reasons I wanted functions in namespaces was to implement callbacks. Now that we have closures in PHP 5.3, for me there is no longer any good reason to have functions in namespaces other than porting legacy code. Because the only remaining serious naming conflict is between namespaced functions and static class methods, I wonder how many people would find closures an acceptable substitute for allowing functions in namespaces? Also, see #3 as a way to solve the question of porting old code. My assumption is that namespaces are best as a library helper for re-usable classes. 2) Do we really need namespaced constants? These can conflict with class constants and there is no way to resolve the difference external to that namespace. 3) Now that it has been pointed out that use can't be used in brackets, could we consider moving namespace syntax to a syntax proposal Dmitry made a while ago: The last example would be for porting legacy un-namespaced code (for instance, utility functions) or global application code that uses the previous stuff. If possible, could answers to these questions be limited to +1/-1? I would like to get a sense of how controversial these ideas are rather than to just debate them. If you absolutely must reply with other ideas, then please start a new thread. Thanks, Greg