On 10/08/07, Stanislav Malyshev <[EMAIL PROTECTED]> wrote:
> My perception is that when people talk about "namespaces" they usually
> mean logical separation of things in, well, naming space, and when they
> talk "packages" they usually mean files on disk and putting things into
> files and finding which thing is in which file. Our implementation is
> much more former than the later. Of course, my perception is mine, and
> everybody is entitled to have their own ones, but I would very much like
> to hear an argument which is not a Siamese twin of "because C++
> namespaces have braces and PHP ones don't". If that would be the only
> reason, I don't think it is a good one. If there are more reasons - I
> would very much like to hear it before we rush forward and commit things
> that would influence PHP for next 10 years.

I don't use C#/C++, but that is what I understand a namespace to be.

We hear issues about "polluting the global namespace", as I understand
it, this is having too many things which are global and this can lead
to other libraries or packages having conflicting names when they are
introduced. So by having other namespaces, we can group related
entities (classes, functions, variables). External to the namespace,
everything within it has a prefix. Ideally the namespace will be
unique (not 100% but the namespace is only required for external code
to access the content of the namespace, so, in theory, a single line
of code is required to be altered to use a different namespace (I
think). Internally, the namespace is not required (I think).

A package is something completely different. It may be a library of
code (or several libraries) or an application or something else
entirely. It may or may not implement a namespace (or even have
multiple namespaces). A newbie coming across PEAR for the first time
will see the word "packages" and I would suggest that trying to
separate the meanings of the word "packages" at this stage would
require more than normal newbie enthusiasm.

I would say a namespace is a programmers thing, whereas a package is
more of a distribution thing.

You code using namespaces to preserve your classes/functions/variables
from global namespace pollution.

When it comes to release the code, you would have a package which
could indicate dependencies on other packages (like PEAR with its
dependency support for example).

So, for what it is worth, namespaces should be called namespaces.

Richard.



-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to