Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39848 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44030 invoked from network); 11 Aug 2008 23:34:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Aug 2008 23:34:06 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.163 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.163 il-gw1.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.163] ([212.25.124.163:42188] helo=il-gw1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EC/83-25857-C6CC0A84 for ; Mon, 11 Aug 2008 19:34:06 -0400 Received: from us-ex1.zend.com ([192.168.16.5]) by il-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 12 Aug 2008 02:34:52 +0300 Received: from [192.168.16.110] ([192.168.16.110]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 11 Aug 2008 16:34:49 -0700 Message-ID: <48A0CC99.4020006@zend.com> Date: Mon, 11 Aug 2008 16:34:49 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 To: Elizabeth M Smith CC: internals@lists.php.net References: <909776579.20080803142659@marcus-boerger.de> <840985F2-A701-4BE4-91F6-F6B39048CF9B@pooteeweet.org> <48A09FF4.1030101@zend.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 11 Aug 2008 23:34:49.0426 (UTC) FILETIME=[D89F7320:01C8FC0A] Subject: Re: [PHP-DEV] Inconsistencies in 5.3 From: stas@zend.com (Stanislav Malyshev) Hi! > "I don't want braces because people would think it acts like C++" is as > silly as saying "I don't want the current namespace Foo; syntax because > people will think it acts like python" Errr... as far as I know Python has no "namespace Foo;" syntax. And as I repeated numerous times, the syntax should be driven primarily by function, not by what decision some guys (even very smart guys) took when they designed entirely different language. The function of PHP namespaces makes {} make little sense, since {} implies bounded (and potentially nested) scope, that is repeatable and has "inside" and "outside". > Thinking as a new user... > How is > namespace foo; > semantically different from > class foo {} > or even > function foo {} 1. Namespace is a tag on the entities defined inside this file, function is not. Class can be viewed as such, kind of, but it'd be very limiting view (class is more than just tag on set of function names). 2. Class and function exist as stand-alone entity, namespace does not. 3. There can be context outside class/function in this file, but not outside namespace. > I'm defining something yes? With stuff basically "inside it". Yes an > oversimplification, but the strength of PHP has always been simple. So > why should it act differently? Why does it need different syntax to > define something? Well, it should act differently for the same reason class and function act differently - because they are different things. ITYM "why the should _look_ differently?". As I said, that is because for them to look the same would be to imply things about namespaces that are not true. > But at the end of the day this is all personal preference. Just > remember the poor people who have to teach this to the new users ;) I can help with that. Here's world's shortest course on PHP namespaces: 1. To define namespace for the file, write "namespace Foo::Bar;" at the beginning of the file. 2. That's it, enjoy. ;) -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com