Hi,

All of the debate over whether this is a true namespace implementation
is in my opinion completely bogus (translate: I think "namespace" is a
fine choice for the reserved word, and "package" is a dangerously
misleading choice), but since there is so much noisy dissent, I have an
alternative proposal I'd like to float:

How about using the keyword "prefix" or "nameprefix" instead of
"namespace"?  This will be clearer and can be easily defined with 2
sentences similar to the original proposal: "All class and function
names inside the file are automatically prefixed with the
(prefix|nameprefix) name.  In other files, classes and functions can be
imported with different names (aliases) to eliminate naming conflicts or
reduce typing needed."

I quote from the original "Simple Namespace Proposal" message by Dmitry:

>From the beginning:
> Main assumption of the model is that the problem that we are to solve is the
> problem of the very long class names in PHP libraries. We would not attempt
> to take autoloader's job or create packaging model - only make names
> manageable. 

>From the middle:
> Namespace definition does the following: 
> All class and function names inside are automatically prefixed with
> namespace name.

As stated, because this proposal *only* defines a prefix for functions
and class names, it is not a packaging model.  All package models in
existence define some kind of self-contained entity that groups related
*files* and their contents together in a way that allows them to be
"packaged" into a single thing, like a jar, a PEAR .tgz, or a .phar
file.  This proposal does none of these things.  Simply because the
prefix is defined per-file does not a package make.  By the same logic,
using ".php" at the end of a file or ".dat" at the end of a file creates
special packages of php or dat information, because the extension
applies to the whole file at once.  Simply defining the contents of a
file does not imply any organization whatsoever.

What the original proposal *does* do is provide a namespace prefix - it
defines a scope within which all names have a special prefix.  This is
not rocket science.

<rant>On a personal note, if you feel you must reply to this thread
further, please follow this checklist:

1) is anything I am saying bring a new idea to the debate?
2) is there a patch that converts my new idea into a reality attached to
the message?

If you can't answer "yes" to either of these, please go immediately to
jail, do not pass go, do not collect $200.</rant>

Thank you to Dmitry for this much-needed idea.

Thanks,
Greg

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

Reply via email to