Hi!

> This is exactly what I'm doing right now, requiring the expression to
> always be enclosed in parenthesis. I think it's way better to be able to
> do this instead of creating temporary variables just to assign a class

Why? What's so bad in variables? It doesn't cost that much and makes you
code clearer.

> name. Also, is_a, since it's a function, is significantly slower than
> instanceof, which is a construct (but of course you already now that).

I find it very hard to accept this particular argument. First, if your
code significantly depends on the speed of instanceof, you probably have
some very uncommon code that does some very uncommon things. For such
code, changing syntax of PHP may be not the best idea. Secondly, if we
discover that the speed of is_a is a common problem, we can treat it -
i.e. by converting it to opcode, etc. - but in general the argument
"function calls are too slow in PHP so we should have duplicates for
them" sounds wrong. They are not *that* slow and in most cases it's
completely fine to use functions. If your particular code is so
performance-sensitive that the speed of instanceof really matters so
much that function call is not acceptable, maybe it's time for a little
C extension?
-- 
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