rfc:namespaceref
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:namespaceref [2008/10/14 21:10] – stas | rfc:namespaceref [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
* Version: 1.0 | * Version: 1.0 | ||
* Date: 2008-03-06 | * Date: 2008-03-06 | ||
Line 17: | Line 17: | ||
Inside namespace, class definition can be used as: | Inside namespace, class definition can be used as: | ||
- | - Imported name - name mentioned in " | + | - Imported name - name mentioned in " |
<code php> | <code php> | ||
use Foo::Bar as Fubar; | use Foo::Bar as Fubar; | ||
$a = new Fubar:: | $a = new Fubar:: | ||
</ | </ | ||
- | - Full name not mentioned in import - Foo:: | + | - Full name not mentioned in import - '' |
- | - ::Foo - global name | + | - '' |
- | - namespace:: | + | - '' |
- | - Unqualified name 'Foo' | + | - Unqualified name "Foo" |
==== Pro ==== | ==== Pro ==== | ||
Line 39: | Line 39: | ||
Functions and constants defined in the namespace are prefixed with the namespace name. | Functions and constants defined in the namespace are prefixed with the namespace name. | ||
- | Quailified function call A::B::C() is resolved as follows: | + | Quailified function call '' |
- All possible " | - All possible " | ||
- | - If function by name " | + | - If function by name " |
- | - Otherwise, treat the call as call to method C of the class " | + | - Otherwise, treat the call as call to method |
- | Unqualified function call foo() inside namespace resolved as follows: | + | Unqualified function call '' |
- If internal function " | - If internal function " | ||
- | - Otherwise, call the function namespace:: | + | - Otherwise, call the function |
Constants resolved in a way identical to functions. | Constants resolved in a way identical to functions. | ||
- | New syntax for static access is introduced: using Name-> | + | New syntax for static access is introduced: using '' |
< | < | ||
ClassName-> | ClassName-> | ||
Line 56: | Line 56: | ||
ClassName-> | ClassName-> | ||
</ | </ | ||
+ | |||
+ | ==== Pro ==== | ||
+ | * The last syntax allows to call static methods unambiguously | ||
+ | * Functions and constants supported | ||
+ | |||
+ | ==== Contra ==== | ||
+ | * The model is more complex and may be confusing for the new users. | ||
+ | * Unqualified name resolutions for classes and functions/ | ||
+ | * New syntax for static access | ||
===== See also ===== | ===== See also ===== |
rfc/namespaceref.1224018625.txt.gz · Last modified: 2017/09/22 13:28 (external edit)