Edit report at https://bugs.php.net/bug.php?id=67773&edit=1
ID: 67773
Updated by: [email protected]
Reported by: [email protected]
Summary: Scope-Resolution Operator
Status: Open
Type: Bug
Package: PHP Language Specification
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
I'm sorry but I don't see where the language implies properties and methods live in the same namespace (the language may have changed since the report, so maybe it's fixed already). I'll add the language making it more clear when :: is used for constants, properties and methods.
Previous Comments:
------------------------------------------------------------------------
[2014-08-05 16:56:20] [email protected]
Description:
------------
https://github.com/php/php-langspec/blob/master/spec/10-expressions.md#scope-resolution-operator
This section makes it sound like class constants and methods and static properties all live in the same namespace (which is wrong, they have distinct namespaces and you can have a method and a class constant with the same name). Also, nothing in this section, other sections, or the syntax rules give enough information allow the reader to distinguish between a ::-style method call expression, a constant access, and a static property access. This is key to describing how a parsed expression involving the :: operator is interpreted by the engine. For example does "C::$x" access a static property of class C named 'x', or does it access a class constant whose name is held in local variable $x? Does "C::$x()" call a method on class C whose name is held in local variable $x, or does it call a callback stored in static property of class C named 'x'? Finally, this section doesn't describe how ::-style method lookup or static property lookup or class constant lookup. For example if th!
ere is are multiple static properties named 'x' (possibly with different public/protected/private modifiers), how do we decide which one gets accessed. Same goes for methods.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67773&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.