Re: Re: New Feature: Fully qualified class name resolution as scalar with class keyword

From: Date: Wed, 18 Apr 2012 19:59:08 +0000
Subject: Re: Re: New Feature: Fully qualified class name resolution as scalar with class keyword
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-60195@lists.php.net to get a copy of this message
Hi! > As already mentioned, There can't be a class constant called "class", > because it is a keyword. (const class = 'Foo' is a syntax error). It looks like class constant. So it should work like one (or, in this case, not work since as you noticed there can not be one). > But yes, I agree that runtime resolution only duplicates existing > behavior, so it isn't really necessary (you could argue thought that > self::class similarly also only replicates the existing __CLASS__). It > would be nice for consistency in my eyes, but I'm good without it too I do not see any "consistency" in creating functionality that is not needed and collides with existing syntax and actually works completely different even though it looks the same. Not much sense to have $foo::bar and $foo::class mean completely different things. foo::bar is static constant expression, so is foo::class, but static::class and $foo::class won't be. It all would be very confusing. I suggest limiting ourselves to constant expressions like foo::class, self::class and parent::class. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227

« previous php.internals (#60195) next »