Bug #67773 [Opn]: Scope-Resolution Operator
| From: | stas@php.net | Date: | Sun, 28 Jun 2015 21:24:45 +0000 |
| Subject: | Bug #67773 [Opn]: Scope-Resolution Operator | ||
| References: | 1 | Groups: | php.standards |
| Request: | Send a blank email to standards-+get-815@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67773&edit=1
ID: 67773
Updated by: stas@php.net
Reported by: joelm@php.net
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] joelm@php.net
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