Re: Namespace issues
| From: | Kristian Koehntopp | Date: | Fri, 17 May 2002 05:40:57 +0000 |
| Subject: | Re: Namespace issues | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6181@lists.php.net to get a copy of this message | ||
On Fri, May 17, 2002 at 12:32:04AM +0200, Stig S. Bakken wrote:
> Next, the default "int-htdoc" location must be specified in PEAR_Config,
> for example as a sprintf format string ala "internal-pear/%s" (relative
> to document root). It has to be there because the installer needs to
> know where to install the int-htdoc files. (Moving them while still
> keeping things plug-and-play is not trivial.)
>
> How the "app-htdoc" files are treated depends a bit on how the Apache
> integration would be. So far I've been toying with the idea of letting
> people choose between a vhost or subdir-based setup.
Ok, how do I get these values in my class, i.e. code example?
> Fine, except I'm not too happy about the long prefix here. There's
> something in the back of my head telling me to limit the length of
> cookie names, so _pear could be a better prefix for GPC vars.
Also ok. I'll be using _pear_<package> then. Making it
configureable would be very expensive to code. I won't do that.
> Storing objects in sessions is sexy, but it adds a lot of bloat too.
> IMHO, everything implicit should be light-weight by default, or PEAR
> will end up as a resource hog that noone can use for really busy sites.
>
> AFAIK you can't have use two sessions simultaneously, so PEAR should
> "leech" on the current session if there is one, and add variables called
> _pear_<name>, or create a session if needed. If you _can_ have
> simultaneous sessions, it's easier of course.
Even if you could have multiple sessions, I'd like not to use
them. It would make debugging overly complicated (now, what are
my session id's at the moment? Into which session did that value
go? Well, I have two sessions containing overlapping names -
which one will overwrite the other?)
> > 4. Namespace in Sessions and in GLOBALS
> >
> > How do we handle namespace issues in sessions? When a PEAR
> > class wants to use variables that have to become of the session,
> > or of the global namespace, what names do we reserve here?
> >
> > Again, I propose internal_pear_<classname> for use by PEAR.
> >
> > What are your opinions on this?
>
> Namespacing for $GLOBALS is already documented and widely used:
>
> _<package>_<variable>
>
> http://pear.php.net/manual/en/standards.naming.php
Is this useful and consistent? I'd rather see
_pear_<package>_<variable> here, but ...
Kristian
--
http://www.amazon.de/exec/obidos/wishlist/18E5SVQ5HJZXG