$obj->attr::method() is not allowed

From: Date: Mon, 03 Sep 2012 14:51:18 +0000
Subject: $obj->attr::method() is not allowed
Groups: php.internals 
Request: Send a blank email to internals+get-62745@lists.php.net to get a copy of this message
Hello, I would like to start with an example: <?php class A {
        public static function foo ( ) {
            return 'foo';
        }
} class B {
        protected $a = null;
        public function __construct ( ) {
            $this->a = new A();
        }
        public function a ( ) {
            return $this->a;
        }
        public function f ( ) {
            return $this->a::foo();
        }
} $b = new B(); var_dump($b->f()); This is not possible. We have a parse error in B::f because $this->a::foo() is not a construction of the language. But we can write: $a = $this->a; $a::foo(); In the same way, we can't write: $this->a()::foo(); I would like to know why? Is it a compiler related issue or just an omission? Would it be interesting to fix it? Best regards. -- Ivan Enderlin Developer of Hoa http://hoa.42/ or http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://disc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/

« previous php.internals (#62745) next »