rfc:namespaceissues
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:namespaceissues [2008/10/16 03:19] – add note as to why Stas's solution doesn't work cellog | rfc:namespaceissues [2008/10/16 13:45] – move Stas explanation to bottom for better reading flow cellog | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Request for Comments: Namespace Issues and Greg's Solutions ====== | ====== Request for Comments: Namespace Issues and Greg's Solutions ====== | ||
- | * Version: 1.1 | + | * Version: |
* Date: 2008-10-15 | * Date: 2008-10-15 | ||
* Author: Greg Beaver < | * Author: Greg Beaver < | ||
Line 46: | Line 46: | ||
</ | </ | ||
- | ==== Why Stas's proposed solution doesn' | ||
- | |||
- | [[rfc: | ||
- | |||
- | > New syntax for static access is introduced: using '' | ||
- | < | ||
- | ClassName-> | ||
- | ClassName-> | ||
- | ClassName-> | ||
- | </ | ||
- | |||
- | Although this would in theory solve the ambiguity, it does not solve the ambiguity for all existing code, which as we know uses this syntax: | ||
- | |||
- | <code php> | ||
- | <?php | ||
- | ClassName:: | ||
- | ?> | ||
- | </ | ||
- | |||
- | In fact, this proposal would require every single reference to a static method or class constant to be rewritten as ClassName-> | ||
- | |||
- | The only fixes that can solve the problem are fixes that do **not** force PHP developers to rewrite code. Every proposal below would only require changes to as-yet-unwritten code. Solution #3 would in fact not even require changes to code written based on PHP 5.3alpha2. | ||
==== The solutions ==== | ==== The solutions ==== | ||
Line 86: | Line 64: | ||
If the " | If the " | ||
+ | |||
+ | Note that existing code relying upon " | ||
+ | a naming conflict. | ||
4. disallow mixing namespaces and classes with the same name | 4. disallow mixing namespaces and classes with the same name | ||
Line 207: | Line 188: | ||
This will be better for 99% of scripts, as evidenced by the ratio of internal vs. userspace classes (see http:// | This will be better for 99% of scripts, as evidenced by the ratio of internal vs. userspace classes (see http:// | ||
+ | |||
+ | ==== Why Stas's proposed solution doesn' | ||
+ | |||
+ | [[rfc: | ||
+ | |||
+ | > New syntax for static access is introduced: using '' | ||
+ | < | ||
+ | ClassName-> | ||
+ | ClassName-> | ||
+ | ClassName-> | ||
+ | </ | ||
+ | |||
+ | Although this would in theory solve the ambiguity, it does not solve the ambiguity for all existing code, which as we know uses this syntax: | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | ClassName:: | ||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | In fact, this proposal would require every single reference to a static method or class constant to be rewritten as ClassName-> | ||
+ | |||
+ | The only fixes that can solve the problem are fixes that do **not** force PHP developers to rewrite code. Every proposal below would only require changes to as-yet-unwritten code. Solution #3 would in fact not even require changes to code written based on PHP 5.3alpha2. | ||
===== Changelog ===== | ===== Changelog ===== | ||
* Version 1.1: add [[# | * Version 1.1: add [[# | ||
+ | * Version 1.1.1: move Classname-> |
rfc/namespaceissues.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1