Re: ignored patches
| From: | Gregory Beaver | Date: | Tue, 04 Dec 2007 16:31:17 +0000 |
| Subject: | Re: ignored patches | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-33649@lists.php.net to get a copy of this message | ||
Martin Alterisio wrote:
> Sorry to step in uninvited to this discussion, I have some doubts about all
> this, and I'll really appreciate if someone more knowledgeable could
> enlighten my ignorance. The doubts I have are as follows:
>
> 1) Why is performance relevant to whether namespaces are implemented one per
> file or many per file?
Because there is a performance difference between code in separate files
and the same code in a single file.
The current namespace implementation does not allow more than 1
namespace per file. These 2 files:
file1.php:
<?php
class a {}
?>
file2.php:
<?php
class b {}
?>
can be combined into this file:
<?php
class a {}
class b {}
?>
Simply by cut/paste and PHP will work.
These two files:
<?php
namespace A;
class a {}
?>
file2.php:
<?php
namespace A;
class b {}
?>
when combined into:
<?php
namespace A;
class a {}
namespace A;
class b {}
?>
result in a parse error.
> 2) I was under the impression namespaces were introduced to improve code
> maintainability. Was I wrong?
You are right. On the flip side, if you can't use your maintainable
code because it is slow as molasses, that is a problem.
Greg