#46668 [Opn->Bgs]: Changing static class operator to "->"
| From: | scottmac@php.net | Date: | Tue, 25 Nov 2008 17:42:00 +0000 |
| Subject: | #46668 [Opn->Bgs]: Changing static class operator to "->" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-131312@lists.php.net to get a copy of this message | ||
ID: 46668
Updated by: scottmac@php.net
Reported By: nightstorm at tlen dot pl
-Status: Open
+Status: Bogus
Bug Type: Feature/Change Request
PHP Version: 6CVS-2008-11-25 (CVS)
New Comment:
You'd break all previously written PHP code if :: suddenly became a
namespace separator.
Previous Comments:
------------------------------------------------------------------------
[2008-11-25 17:09:13] nightstorm at tlen dot pl
Description:
------------
Hi everyone,
I've recently read about some controversies concerning the new
namespace operator and I noticed a possible solution which I want to
share with you. Unfortunately, it breaks the backward compatibility.
The idea is to use "->" both for normal object and static class element
access, as id does not introduce any ambiguity and can be resolved
directly by the lexical parser:
$variable->field - object call
$variable->method() - object call
ClassName->field - static call
ClassName->method() - static call
ClassName->method()->method2()->field - first one is static, the rest
are object calls.
Now "::" can be used as the namespace access operator. I use the same
rules in my template engine to convert the object calls to the PHP
syntax and I'm pretty sure they are correct.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46668&edit=1