Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33788 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3876 invoked by uid 1010); 6 Dec 2007 04:43:55 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 3850 invoked from network); 6 Dec 2007 04:43:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Dec 2007 04:43:55 -0000 Authentication-Results: pb1.pair.com smtp.mail=malterisio777@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=malterisio777@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.198.191 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: malterisio777@gmail.com X-Host-Fingerprint: 209.85.198.191 rv-out-0910.google.com Received: from [209.85.198.191] ([209.85.198.191:6611] helo=rv-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D6/C2-12052-80E77574 for ; Wed, 05 Dec 2007 23:43:54 -0500 Received: by rv-out-0910.google.com with SMTP id k15so98632rvb for ; Wed, 05 Dec 2007 20:43:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=Jb1tiVXc3jk8EPjxR72fc6+HN1A/GV7FGeAA5arJmyk=; b=MpEIrlzkgu6npcgDwkM1dQGD1FXiCjbBYbt1hUKDqfJdiSpaG2cu5z0SaF9CtMbTISQVY/J2/w+IfDmuLftkck+Cw/Ggf0Zcnb59wJDs2YLme5TdQiYHZpXMuvQYhN/b5VFvZeYZWCAizIicmPo/iy0Z/SqvutznG56eHa4Jcak= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=cBGzRnrEVZSQlYXzyv3+krgyaIBGGNjPwqsn9EPUCVNHyFtjNoAH3HnYrsema6oVh9NrnqfVIEeUWcus5lN+gqTOwc1Pket0ZmYW5VCnm/goR1AHI7zDd0SdUcN7k0nF92z9YWe9C8Ml99Iks9DiDr1r4PdBjjc+3TbnKPqK8N4= Received: by 10.143.14.16 with SMTP id r16mr1456211wfi.1196916228666; Wed, 05 Dec 2007 20:43:48 -0800 (PST) Received: by 10.142.157.9 with HTTP; Wed, 5 Dec 2007 20:43:48 -0800 (PST) Message-ID: <52dbac0f0712052043p466923e6vaf2f40e6714aa775@mail.gmail.com> Date: Thu, 6 Dec 2007 01:43:48 -0300 To: "PHP Developers Mailing List" In-Reply-To: <47571BF1.10202@keryx.se> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4385_20612538.1196916228663" References: <4755FB31.2050901@zend.com> <4756E3AF.2070703@zend.com> <4756EC80.1070500@iamjochem.com> <4756F146.3050306@zend.com> <47571BF1.10202@keryx.se> Subject: Re: [PHP-DEV] Namespace From: malterisio777@gmail.com ("Martin Alterisio") ------=_Part_4385_20612538.1196916228663 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 2007/12/5, Keryx Web : > > Stanislav Malyshev skrev: > >> +1 for putting namespaces on the backburner and taking the time to > >> get it 100% right ... > > > > What's "100% right"? Any proposals (besides braces)? > > > > Actually I did mention an alternative a while ago, and that would be to > learn from ECMAScript 4. This is from John Resigs talks: > > import dojo.query; > import jquery.query; > > use namespace dojo; > query("#foo") // using dojo > > use namespace jquery; > query("div > .foo") // using jquery But ECMAScript 4 namespaces are not even like the namespaces we're discussing here. In that language there's both packages and namespaces. Packages define class grouping and namespaces work like visibility declarations (public/protected/private). In the above example what's happening behind the scenes is the following: package dojo { public namespace dojo; dojo function query(....) { .... } } package jquery { public namespace jquery; jquery function query(....) { .... } } The use namespace directive in ECMAScript4 means: "I want to be able to see the constructs marked with the namespace provided" Which is different to: "Bring that construct from that scope to my current scope" (import) The first one affects every name and scope, you'll see everything the "namespace" has to offer, and "namespaces" exist as an object. the second one is just, practically speaking, a way to make a shortcut for a larger name. This makes sense when you're working with E4X because XML namespaces are binded to namespaces in code. But take an advice from one that has been working with an ECMAScript4 compliant language: KEEP AWAY FROM ECMASCRIPT4 NAMESPACES. ------=_Part_4385_20612538.1196916228663--