Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:30958 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52279 invoked by uid 1010); 16 Jul 2007 07:01:40 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 52263 invoked from network); 16 Jul 2007 07:01:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2007 07:01:40 -0000 Authentication-Results: pb1.pair.com header.from=d.giedrius@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=d.giedrius@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.146.178 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: d.giedrius@gmail.com X-Host-Fingerprint: 209.85.146.178 wa-out-1112.google.com Received: from [209.85.146.178] ([209.85.146.178:4953] helo=wa-out-1112.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E7/A4-30659-2D71B964 for ; Mon, 16 Jul 2007 03:01:39 -0400 Received: by wa-out-1112.google.com with SMTP id l24so1589126waf for ; Mon, 16 Jul 2007 00:01:35 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Rf//QzOg4jjnT1027FpVExUV206yy4SHOVJk9cIdlBFeYvgKnBAKB39Iq6VM+mSoZR3UavavrTOe35mFFs3lM5IcfxXNXPYkrUHTh4WVaHx/RpOipCfm3mKqVBlRWOuuIuhDF4hwpECn1O4VDgo44yKl6OpxjHGLRD6LCTQqT1U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=e2XJJs0amhC+LESET5RtEprlVlj7xAYbSq7Qz/iDaGbk8a+Bk0XrLzWuCD7K9CyHEzP1Ob+VUJe0s4h97X/sLhQ/fpWIp+sGT1t7BUiUFNql6Q8zG2FkoFHmiFyBBR8Aq1tlZKrFCLLAyn/BOLuoE3b/cLGJHSEn8u+PiJ+QzrQ= Received: by 10.114.177.1 with SMTP id z1mr3859028wae.1184569295514; Mon, 16 Jul 2007 00:01:35 -0700 (PDT) Received: by 10.114.144.12 with HTTP; Mon, 16 Jul 2007 00:01:35 -0700 (PDT) Message-ID: <3d1a63d10707160001p64eff2fdy3fa1707679a5d05b@mail.gmail.com> Date: Mon, 16 Jul 2007 10:01:35 +0300 To: "Stanislav Malyshev" Cc: internals@lists.php.net In-Reply-To: <469AD3F8.40109@zend.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3d1a63d10707150624y2b166f33y1bf3f628aba596b2@mail.gmail.com> <469AD3F8.40109@zend.com> Subject: Re: [PHP-DEV] Simple Namespace Proposal From: d.giedrius@gmail.com ("Giedrius D") On 7/16/07, Stanislav Malyshev wrote: > > The other thing that bothers me is namespaces nesting. It was said > > that namespaces > > nesting is not supported. Then I'm missing a point in having namespace > > named "A::B". > > The same reason some people write $a = f($z, $t) and some write > $parsed_template = template_parser($template, $data_values) :) > I wasn't talking about a short/long names :-) I was talking about a separator inside a namespace name. > > Lets say I have three files: > > > > a.php: > > > namespace A; > > > > function foo() > > { > > } > > ?> > > > > b.php: > > > namespace A::B; > > > > function bar() > > { > > //foo(); > > } > > ?> > > > > index.php: > > > require 'a.php'; > > require 'b.php'; > > > > import A; > > foo(); // should call A::foo(), right? > > B::bar(); // will this call A::B::bar()? > > ?> > > import A is a no-op. You do import A::B and then you can do B::bar. > import N means "something that is named N can now be referred only by > it's 'last name' last(N), last name being last segment of the long > name". If you have short names, you don't need namespaces, but if you > have names like PEAR::DB::Record::Type::Modifier::Exception, you > probably do :) > > > Now if this does not work then whats the point in having namespace > > "A::B" instead of "A_B"? IMHO this brings more confusion then > > clearness. > > The point is you can a) omit namespace prefix inside namespace and b) > use just B (or C if you wish) instead of A::B outside, once you did > import. As I said, with long names it makes sense, with short ones you > are OK without it. a) I was talking about namespace name "A_B" not class/function name. b) So as far as I understand "import" doesn't actually *import* names from specified namespace to the current one but just renames long namespace name to a shorter one. And if I get it right the separator in the namespace name is allowed and required only to express default name when importing without "as". Am I right? Regards, Giedrius