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
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
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
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
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
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%.
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
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
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
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
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
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
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
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
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.
>
>
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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
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
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
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
+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
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
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
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
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
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
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
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
41 matches
Mail list logo