Advice from an outsider, hopefully useful
| From: | Greg Beaver | Date: | Thu, 28 May 2009 06:25:26 +0000 |
| Subject: | Advice from an outsider, hopefully useful | ||
| Groups: | php.standards | ||
| Request: | Send a blank email to standards-+get-20@lists.php.net to get a copy of this message | ||
Hi,
I just read the few messages on the standards list, and would like to
make a quick suggestion. Before you all pull the trigger of that weapon
aimed at your collective feet, take a page from the W3C, and do an
extended period to request comments on the standards from the public
before announcing them as finalized. Otherwise the risk is a standard
in name only.
Another way of thinking of it: you all are the esteemed ambassadors from
your projects, but you still have to return home and convince your
partisan bickering masses that what you have negotiated with foreign
powers is in their best interest.
About the actual proposal, For me, some more clarification/changes are
needed on a few points:
1) The standard only mentions Underscored_Classnames, but has no mention
of the truly standard way of doing things: Backslashed\Classnames.
ns\name\Class\Name works just fine (the namespace/class barrier is
obvious - the first capital letter is the start of the classname), and
allows access to sub-namespaces using "relative namespace paths" (see
the manual for clarification on this point, it was not present in early
alphas of PHP 5.3).
2) Why is the package name present with underscores in the namespace
name? I raised strong objections to this point over a year ago when it
was first proposed to PEAR, and these seem to have been ignored. It
will encourage coding mega-packages or weird hacks like empty shell
classes (namespace ns/package;class Classname extends
ns/split_package/Classname {}) for API BC compatibility. Far simpler,
and much better, is to require vendor\ only, and to allow
vendor-specific class name/package name mapping with a suggested format.
3) Arguments or standards suggestions that were ruled out need to be
documented as well, or you'll find that newcomers talk in circles
re-hashing everything.
Let's also not ignore ezComponents or pecl/automap solution to locating
classes - a static array mapping class name to file. This is much more
performant in autoload (no include_path search), but requires the extra
step of generating the static array. Thus the standards should mention
that vendors may provide a vendor-specific autoload which should be
loaded before the standardized one.
In general, I'd say this is a step in the right direction.
Greg