Re: multiple namespace per file

From: Date: Mon, 10 Sep 2007 23:58:39 +0000
Subject: Re: multiple namespace per file
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-32225@lists.php.net to get a copy of this message
On 9/10/07, Stanislav Malyshev <stas@zend.com> wrote: > > Ok, I was wondering to myself, do you guys think it would be possible > > to do something like having an endnamespaces; keyword that would put > > an end to the namespace definition? > > Oh no :) It doesn't look good and it doesn't solve the problem. Hint: > the braces have the same problem (that's why I asked not to suggest them > :) since the problem is per-file imports vs. multiple global spaces. I > can explain more if you wish but basically it's not about finding the > right delimiter, it's about making something that would work when files > are combined together (repeatedly). If you allow global space there, it > starts to look and work seriously weird. > -- Yeah you are right, I also thought it looked extremely ugly. I have thought of a few things (since I am the combined/aggregated files advocate) and I actually think that this approach (Having multiple namespace per file like you mentionned) would work pretty well. After taking a look at this problem from another point of view, I realized that if we can manage to make the multiple namespace per file as you mentionned earlier then it would be rather trivial. I like the implementation you suggested earlier, you got +1 from me ;-) More question, just like this, when you do: <?php namespace A; require 'somefile.php'; class AX{} namespace B; class BX{ } ?> is somefile.php also included in the B namespace since you cannot include it in global scope. Next step ? Renaming to packages ? :P (No please dont anyone it's just a joke) > Stanislav Malyshev, Zend Software Architect > stas@zend.com http://www.zend.com/ > (408)253-8829 MSN: stas@zend.com > > Thanks, -- David Coallier, Founder & Software Architect, Agora Production (http://agoraproduction.com) 51.42.06.70.18

« previous php.internals (#32225) next »