Hi!

> What I want to implement is the ability to allow arbitrary expressions on
> the second operand, so instead of having to write something like this:

I'm afraid there's a problem with this. Arbitrary expressions include
constants, right? So what this means:

var_dump($foo instanceof Bar);

is it checking $foo for being instance of class Bar (that's what is
happening now) or is it taking the value of the constant Bar (whatever
it is) - since constant is an expression - and using it as a class name
and then checking if $foo is an instance of that class?

You could of course require the expression to always be enclosed in (),
but that produces weird syntax where some forms of instanceof work
without () and some only with (). Given that you can easily assign your
value to a variable, is it worth it?

Also, you can always use is_a($foo, $bar->getClassName()).
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/

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

Reply via email to