Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:39854 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57042 invoked from network); 12 Aug 2008 00:37:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Aug 2008 00:37:16 -0000 Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:51783] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3E/56-25857-B3BD0A84 for ; Mon, 11 Aug 2008 20:37:16 -0400 Received: from MBOERGER-ZRH.corp.google.com (139-85.107-92.cust.bluewin.ch [92.107.85.139]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id B943D11DCF4; Tue, 12 Aug 2008 02:37:12 +0200 (CEST) Date: Tue, 12 Aug 2008 02:36:41 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <628549763.20080812023641@marcus-boerger.de> To: Stanislav Malyshev CC: Elizabeth M Smith , internals@lists.php.net In-Reply-To: <48A0CC99.4020006@zend.com> References: <909776579.20080803142659@marcus-boerger.de> <840985F2-A701-4BE4-91F6-F6B39048CF9B@pooteeweet.org> <48A09FF4.1030101@zend.com> <48A0CC99.4020006@zend.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Inconsistencies in 5.3 From: helly@php.net (Marcus Boerger) Hello Stanislav, Tuesday, August 12, 2008, 1:34:49 AM, you wrote: > 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. ;) 3. You want another namespace, just write namespace again. 4. You got lost after the 10th namespace? Welcome to if-else nesting ambiguty all over again. Some coding style guides force curly braces for if-else for a reason. Best regards, Marcus