I don't agree that instanceof on a class which doesn't exist should work. It doesn't do so in other languages (or at least not in Java/C++(dynamic_cast)) nor does it really seem to make a lot of sense and be useful. Sounds more like an edge case you have hit with some weird code which can probably be written differently.

Today, fetching of classes in the language is very generic, and they have to exist. I see very few cases where this would not be true if you are writing a regular application. In those few cases where you are doing something extremely weird, you can use reflection to introspect an object.

There is no way this would be changed for RC1 (or PHP 5.1) because it's a significant change which would affect many places and not only instanceof. I personally think it shouldn't be changed at all. If you're referencing classes/exceptions in your code that don't exist, then something is very bogus with your code. Don't use a NonExistantException if that could happen, use Exception...

Andi


At 08:17 PM 8/8/2005 +0200, Marcus Boerger wrote:
Hello Michael,

Monday, August 8, 2005, 6:26:30 PM, you wrote:

> Hi Pierre-Alain Joye, you wrote:

>> I can write a patch to "fix" it if we agree that the current
>> behavior is not correct.

> While you're at it, could you continue on fixing the following:
> (another evidence that the current "generic" behaviour is bad)

> try {
>         // anything
> } catch (NonExistantException $e) {
> }

> Fatal error: Class 'NonExistantException' not found

This is a very different topic. While "instanceof missingclass" can never
result to any problem the former violates hard coded requirements. Thus i
think dropping the message from instanceof is acceptable - but i am not
going to decide this so don't take my second thoughts on this one too
serious.

Best regards,
 Marcus

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

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

Reply via email to