Re: Re: New Feature: Fully qualified class name resolution as scalar with class keyword
| From: | Ralph Schindler | Date: | Sat, 08 Sep 2012 05:12:40 +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 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62902@lists.php.net to get a copy of this message | ||
Hey Stas, et. al.,
I think I've addressed some of your concerns and completed this feature/patch.
https://github.com/php/php-src/pull/187
More inline ...
The current patch allows for the following: self::class -> resolves to name in active_class_entry static::class -> resolves to FCALL get_called_class() parent::class -> resolves to FCALL get_parent_class() I would have liked to have done parent::class w/o FCALL but the active_class_entry's parent is empty even when inside of a class extending another class.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
$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$foo::class is not syntax that is currently handled (you will get a parse error: unexpected T_CLASS here. I think that is what you were ultimately suggesting, no? Feedback is welcome, either here or in the pull request. Thanks! Ralph