On Thu, Nov 6, 2014 at 3:49 PM, Andrea Faulds <a...@ajf.me> wrote: > 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 >
Yeah, that makes perfect sense. Also, I just realized that HHVM accepts expressions wrapped in parenthesis. I might need to take a look at how it's done there. Daniel Ribeiro http://danielribeiro.org