Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Daniel Convissor
On Wed, Aug 10, 2005 at 01:03:06AM +0200, Marcus Boerger wrote: > Wednesday, August 10, 2005, 12:38:49 AM, you wrote: > > On Tue, Aug 09, 2005 at 02:07:27PM -0400, George Schlossnagle wrote: > >> > >> if(class_exists('MyFoo') && $obj instanceof MyFoo) { } > > > > Unfortunately, class_exists() stil

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Marcus Boerger
Hello Daniel, RTFM: try class_exists(..., false) marcus Wednesday, August 10, 2005, 12:38:49 AM, you wrote: > On Tue, Aug 09, 2005 at 02:07:27PM -0400, George Schlossnagle wrote: >> >> if(class_exists('MyFoo') && $obj instanceof MyFoo) { } > Unfortunately, class_exists() still calls __autol

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Daniel Convissor
On Tue, Aug 09, 2005 at 02:07:27PM -0400, George Schlossnagle wrote: > > if(class_exists('MyFoo') && $obj instanceof MyFoo) { } Unfortunately, class_exists() still calls __autoload(). Un-deprecating is_a() seems to be an easy way to resolve this situation. --Dan -- T H E A N A L Y S I S

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Jochem Maas
Andi Gutmans wrote: My the way, the performance argument wouldn't work because even if this would be supported, we'd have to first "try" and load the class to make sure we can actually check the instanceof, and only if the class doesn't load then we would return false. So you won't save that st

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Andi Gutmans
At 09:55 PM 8/9/2005 +0200, Pierre-Alain Joye wrote: On Tue, 09 Aug 2005 12:44:59 -0700 Andi Gutmans <[EMAIL PROTECTED]> wrote: > But that's a good point. For the few frameworks that might > require such functionality they can use class_exists() or other > methods. That doesn't mean we should ch

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Pierre-Alain Joye
On Tue, 09 Aug 2005 12:44:59 -0700 Andi Gutmans <[EMAIL PROTECTED]> wrote: > But that's a good point. For the few frameworks that might > require such functionality they can use class_exists() or other > methods. That doesn't mean we should change instanceof for > mainstream usage which is 99.99%.

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Andi Gutmans
At 02:07 PM 8/9/2005 -0400, George Schlossnagle wrote: To duplicate the old semantic now you need to do: if(class_exists('MyFoo') && $obj instanceof MyFoo) { } which is definitely uglier than if(is_a($obj, 'MyFoo')) {} George But that's a good point. For the few frameworks that might requir

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Pierre-Alain Joye
On Tue, 09 Aug 2005 12:29:45 -0700 Andi Gutmans <[EMAIL PROTECTED]> wrote: > we'd have to first "try" and load the class to make > sure we can actually check the instanceof Pardon me? :) As I said in my 2nd post about this topic, the problem (and only problem here) is that in the lexer, the rig

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Andi Gutmans
My the way, the performance argument wouldn't work because even if this would be supported, we'd have to first "try" and load the class to make sure we can actually check the instanceof, and only if the class doesn't load then we would return false. So you won't save that step of trying to load

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Lukas Smith
Andi Gutmans wrote: I am not stubborn. I just think this has close to 0 use in real-life (or you're doing some weird coding). In any case, for the one in a million case, I think Reflection is good enough. I worded my example a bit wrong. I dont like people loading PEAR.php on demand. However

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Andi Gutmans
I am not stubborn. I just think this has close to 0 use in real-life (or you're doing some weird coding). In any case, for the one in a million case, I think Reflection is good enough. Andi At 08:40 AM 8/9/2005 +0200, Michael Wallner wrote: Hi Andi Gutmans, you wrote: > You are wrong because

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread George Schlossnagle
On Aug 9, 2005, at 5:56 AM, Pierre-Alain Joye wrote: On Tue, 9 Aug 2005 10:15:15 +0200 (CEST) [EMAIL PROTECTED] (Derick Rethans) wrote: On Tue, 9 Aug 2005, Pierre-Alain Joye wrote: This technique is already frequently used to cope with lazy loaded code, which even with cached code compile

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Wez Furlong
Maybe a little late throwing my 2 cents in, but here they are anyway. If you're writing an app that can optionally use a component that is not present, there is nothing conceptually wrong with calling instanceof to determine if that support is present; PHP should not blow up. If the class is not l

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Daniel Convissor
On Tue, Aug 09, 2005 at 02:31:08PM +0800, Alan Knowles wrote: > > 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.. Hear, hear! --Dan -- T H E A N A L Y S I S

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Pierre-Alain Joye
On Tue, 09 Aug 2005 13:24:56 +0300 [EMAIL PROTECTED] (Pasha Zubkov) wrote: > Alan Knowles wrote: > > 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. > >

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Pasha Zubkov
Alan Knowles wrote: > 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. You can use `if (!($obj instanceof SomeRarelyUsedClass))` ;) Why statement `$obj instanceo

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Michael Wallner
Hi Stanislav Malyshev, you wrote: > 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. Yes, unit tests could catch such issues. > MW>>There could be a flag to let instanceof *not* die - > MW>>a little less generi

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Stanislav Malyshev
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

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Pierre-Alain Joye
On Tue, 9 Aug 2005 10:15:15 +0200 (CEST) [EMAIL PROTECTED] (Derick Rethans) wrote: > On Tue, 9 Aug 2005, Pierre-Alain Joye wrote: > > > > This technique is already frequently used to cope with lazy > > > loaded code, which even with cached code compilers, is pretty > > > damn efficient in a scrip

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Lukas Smith
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

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Derick Rethans
On Tue, 9 Aug 2005, Pierre-Alain Joye wrote: > > 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 t

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-09 Thread Pierre-Alain Joye
On Tue, 09 Aug 2005 14:31:08 +0800 [EMAIL PROTECTED] (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, i

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-08 Thread Derick Rethans
On Mon, 8 Aug 2005, 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! Right, and there is no reason why it shouldn't blo

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-08 Thread Michael Wallner
Hi Andi Gutmans, you 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! No insult intended, but this is just stubborn. You want to hear

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-08 Thread Alan Knowles
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() pro

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-08 Thread Andi Gutmans
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! Andi At 07:44 AM 8/9/2005 +0200, Pierre-Alain Joye wrote: On Mon, 08 Aug 2005 14:43:25 -0700

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-08 Thread Pierre-Alain Joye
On Mon, 08 Aug 2005 14:43:25 -0700 [EMAIL PROTECTED] (Andi Gutmans) wrote: > 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.

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-08 Thread Andi Gutmans
At 11:55 PM 8/8/2005 +0200, Lukas Smith wrote: Andi Gutmans wrote: 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

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-08 Thread Lukas Smith
Andi Gutmans wrote: 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

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-08 Thread Andi Gutmans
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 proba

[PHP-DEV] Re: RC1, instanceof?

2005-08-08 Thread Pierre-Alain Joye
On Mon, 08 Aug 2005 18:26:30 +0200 [EMAIL PROTECTED] (Michael Wallner) 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

Re: [PHP-DEV] Re: RC1, instanceof?

2005-08-08 Thread Marcus Boerger
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 "ge

[PHP-DEV] Re: RC1, instanceof?

2005-08-08 Thread Michael Wallner
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 (NonExistant

RE: [PHP-DEV] Re: RC1, instanceof?

2005-08-08 Thread David Zülke
+1 > -Original Message- > From: Pierre-Alain Joye [mailto:[EMAIL PROTECTED] > Sent: Monday, August 08, 2005 9:32 AM > To: internals@lists.php.net > Subject: [PHP-DEV] Re: RC1, instanceof? > > On Fri, 05 Aug 2005 13:52:13 -0700 > [EMAIL PROTECTED] (Andi Gutma

[PHP-DEV] Re: RC1, instanceof?

2005-08-08 Thread Pierre-Alain Joye
Hello, I took a short look to the implementation. instanceof_ex works as expected, no error display there. The problem comes from the usage of class_name_reference in the parser. class_name_reference calls zend_do_fetch_class, which raises this error as no class is loaded. Now I'm not sure abou

[PHP-DEV] Re: RC1, instanceof?

2005-08-08 Thread Pierre-Alain Joye
On Fri, 05 Aug 2005 13:52:13 -0700 [EMAIL PROTECTED] (Andi Gutmans) wrote: > Hi all, > > Another reminder, I'd like to roll RC1 on Monday. Everyone will > be back from OSCON and we can start the Unicode merge right > afterwards. One thing I would like to solve in 5.1 is instanceof (or the deprec

Re: [PHP-DEV] Re: RC1

2004-03-08 Thread Pierre-Alain Joye
On Sun, 7 Mar 2004 23:29:33 +0100 [EMAIL PROTECTED] (Marcus Boerger) wrote: > Hello Pierre-Alain, > > go ahead. This is the correct solution to the specs. Done, both 4.3 and HEAD. pierre -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.ph

Re: [PHP-DEV] Re: RC1

2004-03-08 Thread Marcus Boerger
Hello Pierre-Alain, go ahead. This is the correct solution to the specs. Friday, March 5, 2004, 9:29:21 PM, you wrote: > On Fri, 05 Mar 2004 22:18:09 +0200 > [EMAIL PROTECTED] (Andi Gutmans) wrote: >> definitely be fixed. A couple of others don't look like show >> stoppers. If there's anyone he

Re: [PHP-DEV] Re: RC1

2004-03-05 Thread Andi Gutmans
At 09:29 PM 3/5/2004 +0100, Pierre-Alain Joye wrote: On Fri, 05 Mar 2004 22:18:09 +0200 [EMAIL PROTECTED] (Andi Gutmans) wrote: > definitely be fixed. A couple of others don't look like show > stoppers. If there's anyone here who can look at the non-Zend > Engine ones that would be nice. Is it ok t

[PHP-DEV] Re: RC1

2004-03-05 Thread Pierre-Alain Joye
On Fri, 05 Mar 2004 22:18:09 +0200 [EMAIL PROTECTED] (Andi Gutmans) wrote: > definitely be fixed. A couple of others don't look like show > stoppers. If there's anyone here who can look at the non-Zend > Engine ones that would be nice. Is it ok to commit this patch (attachment) to fix #27238? (D

[PHP-DEV] Re: RC1

2004-02-04 Thread Joe Estock
On 2/4/2004 12:20 PM, Zeev Suraski wrote: Hey, As you must have realized Andi and I have resolved some of the key remaining issues for PHP 5 (and we still are). Due to fact that some of these changes have been pretty big changes we suggest to turn the RC1 we wanted to release at the end of Janu