following some discussions on the list (re. multiple namespaces in file)
as well as a short discussion on IRC regarding not being able to do
"use yeti::xml::DomDocument as DomDocument;" - I do not see any point in having
You mean like ability to override existing classes? I think it could be
done but I don't see it as a good idea - it probably would lead to some
weird programming mistakes.
1. As it is impossible to do "use XXX as NativeClass" we get to the
point where we'd have to namespace new internal native classes
otherwise we might introduce BC breaks. AFAIK, we've always said that
There's very easy solution to this, if it ever becomes a problem - using
two-component names.
2. You have to import every class yourself. You can currently not do:
use myNamespace::* as *; // or similar syntax
Right, you can't - but you can use two-component names, i.e.
myNamespace::Name.
3. We keep bickering over using { } or not, multiple namespaces in a
file or not... etc. I understand that people want more flexibility,
but also we need a *simple* to explain implementation. With the
That's why not all flexibility gets in.
- You can't stick multiple namespaces in one file
You are not supposed to unless you using it as performance solution,
which is rather dubious practice anyway.
- Unlike other constructs in PHP that mark executable blocks,
namespaces don't use { }.
That's because namespaces are not executable blocks.
- The "namespace" keyword at the start of a file is somewhat magic,
because it can only appear as first element in your script.
Yes, it is somewhat magic, because it changes how names behave. If the
whole thread is really reincarnation of the braces theme - I think you
could just link to the archive, as I don't see any arguments here that
weren't discussed to death three times.
4. What is wrong with simple prefixes in the first place? Both PEAR_*,
Zend_*, ezc*, and ezp* are perfectly acceptable markers for different
'namespaces'. We could optionally create a registry on php.net for
this to avoid conflicts.
What is wrong is names like
PEAR_DB_Data_Database_Module_Adapter_Implementation_Interface_Exception_Information_Collection_Element.
When you write a code that uses such names, you really don't want to
repeat all the thing every time.
useful - or what particular case they solve... so I am wondering, are they
really useful? I come now to the conclusion that they are not, and for myself
Yes, they are.
(and most likely my work projects) I would have to decide not to go with
namespaces, but instead stick with the 3 letter prefixing. Something that I
Well, the loss is all yours :)
--
Stanislav Malyshev, Zend Software Architect
[EMAIL PROTECTED] http://www.zend.com/
(408)253-8829 MSN: [EMAIL PROTECTED]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php