MW>>to *load* a class for checking an object to be of a specific class
MW>>
MW>>- just because of the simple reason that the checked object can not
MW>>  be of *that* class, because it doesn't exist.

I think, if we leave alone the implementation, there's nothing logically 
wrong to return false if we ask "is $foo instance of class Bar" and we 
don't know what Bar is - just because if we don't know Bar $foo is 
definitely not instance of it. Now the only problem I see here is if you 
type Bar when you intended to type Baz - but I'm not sure this warrants 
the fatal error. Also, autoloading a class is rather expensive operation 
in PHP (and loading it regualr way too, generally, if we consider all the 
library classes we might need), so IMHO the idea that instanceof may 
return (maybe with some warning/notice) false on unknown class doesn't 
look that bad to me. Though, then it would be inconsistent with 
typehinting, for example - which I feel _should_ error out if typehint 
requires unknown class. 

MW>>There could be a flag to let instanceof *not* die -
MW>>a little less generic but more suited for the actual needs IMO.

I don't like the idea of all kinds of flags changing language behaviour. 
This promotes incompatible coding and effectively forks language into a 
set of incompatible sub-languages. Not having any defined behaviour is 
much worse than having behaviour that somebody dislikes.
-- 
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED]  http://www.zend.com/ +972-3-6139665 ext.115

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

Reply via email to