Alan Knowles wrote:
On Mon, 2005-08-08 at 23:08 -0700, Andi Gutmans wrote:

You are wrong because __autoload() *is* called and you can load the class on the-fly. The only problem is if the class does not exist in your code base, in which case, your application should blow up!


The basic point is that is_a() provided negative testing of non-existant
classes
if (!is_a($obj, "SomeRarelyUsedClass")) { ....

instance_of does not, and can not, at present.
This technique is already frequently used to cope with lazy loaded code,
which even with cached code compilers, is pretty damn efficient in a
scripted language (less IO operations, less parsing, less memory...)

It is not about the fact we 'can' load the class, but that we dont
'want' to load the class.. - it's a waste of resources, memory, cpu etc.
just for the sake of CS perfection..
Last time I looked PHP was about getting thing done efficiently, not
about giving your university professor a woody... ;)

I agree with Alan. I guess lazy loading is the key here and __autoload() to me is about being able to do just that. However if we trigger the lazy loading mechanism all over the place, then that defeats the purpose. However like I said the straighforward solution is to underecate is_a() and leave instanceof as is.

regards,
Lukas

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

Reply via email to