> On 6 Nov 2014, at 11:43, Daniel Ribeiro <drgom...@gmail.com> wrote: > > On Thu, Nov 6, 2014 at 3:36 PM, Andrea Faulds <a...@ajf.me> wrote: > >> Perhaps, dare I say it, we should merge the constant and class namespaces >> in PHP7? Those are perhaps the least likely to conflict. It’d mean we could >> handle instanceof expressions, and we wouldn’t need to use ::class. > > > Hi Andrea! > > I'm not sure I understand what you mean by "don't need to use ::class”.
By merging the symbol tables, you could reference classes like constants (perhaps it’d return some sort of ReflectionClass-like thing?): $x = SomeClass; $foo = new $x; Currently, because SomeClass above would resolve to a constant, you have to use the weird pseudo-constant ::class: $x = SomeClass::class; It also would mean instanceof could accept arbitrary expressions, as there’d be no syntactic ambiguity: class Foo {} const Bar = ‘Foo'; $x = (new Foo) instanceof Bar; // works (Bar resolves to ‘Foo’, valid class name) $x = (new Foo) instanceof Foo; // works (Foo is a class) const Foo; // Not allowed, conflicts with class -- Andrea Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php