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 ...

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

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.

$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


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to