Re: [PHP-DEV] Re: Static weirdness..

2004-02-23 Thread Wez Furlong
Please drop this thread; we're not changing the behaviour of static. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: Static weirdness..

2004-02-23 Thread Josh Fuhs
Quoting Marcus Boerger <[EMAIL PROTECTED]>: > In fact it may be related. As i said before it is one of the ways to get to > a class. > The class is related to the object. The method is related to the class. Is the method related to the object? It is not. There are many indirect ways to get to a

Re: [PHP-DEV] Re: Static weirdness..

2004-02-23 Thread Marcus Boerger
Hello Josh, Sunday, February 22, 2004, 6:30:38 AM, you wrote: > If I'm not mistaken, Java does not allow calls to static methods via object > instances. It simply doesn't make sense to couple the unecessary object instance > into a method call in which it has absolutely no bearing. > If the obje

Re: [PHP-DEV] Re: Static weirdness..

2004-02-23 Thread Hartmut Holzgraefe
Josh Fuhs wrote: Quoting Josh Fuhs <[EMAIL PROTECTED]>: If I'm not mistaken, Java does not allow calls to static methods via object instances. Sorry, I retract this. Someone just showed me an example of it. But it still seems like a bad practice. So why? as i stated before the only difference betw

Re: [PHP-DEV] Re: Static weirdness..

2004-02-22 Thread Josh Fuhs
> Quoting Josh Fuhs <[EMAIL PROTECTED]>: > If I'm not mistaken, Java does not allow calls to static methods via > object instances. Sorry, I retract this. Someone just showed me an example of it. But it still seems like a bad practice. Josh -- PHP Internals - PHP Runtime Development Mailing Li

Re: [PHP-DEV] Re: Static weirdness..

2004-02-22 Thread Marcus Boerger
Hello Josh, Sunday, February 22, 2004, 6:44:14 AM, you wrote: > Sorry, mis-click. > Quoting Josh Fuhs <[EMAIL PROTECTED]>: >> If I'm not mistaken, Java does not allow calls to static methods via object >> instances. It simply doesn't make sense to couple the unecessary object >> instance >> int

Re: [PHP-DEV] Re: Static weirdness..

2004-02-22 Thread Herr Witten
Also, direct usage of classnames should be allowed, and in this case, the usual syntax should be used. ClassName->staticMethod(); On 22 Feb 2004, at 12:30 AM, Josh Fuhs wrote: $stringName::staticMethod(); -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://ww

Re: [PHP-DEV] Re: Static weirdness..

2004-02-21 Thread Josh Fuhs
Sorry, mis-click. Quoting Josh Fuhs <[EMAIL PROTECTED]>: > If I'm not mistaken, Java does not allow calls to static methods via object > instances. It simply doesn't make sense to couple the unecessary object > instance > into a method call in which it has absolutely no bearing. > > If the objec

Re: [PHP-DEV] Re: Static weirdness..

2004-02-21 Thread Josh Fuhs
If I'm not mistaken, Java does not allow calls to static methods via object instances. It simply doesn't make sense to couple the unecessary object instance into a method call in which it has absolutely no bearing. If the object has nothing to do with the operation, then there's no point for it to

Re: [PHP-DEV] Re: Static weirdness..

2004-02-21 Thread Herr Witten
Isn't this a contradiction? On 21 Feb 2004, at 9:10 PM, Art Hundiak wrote: static methods and static class variables should be consistent. Currently, you cannot access a class variable via an object instance. And for what it's worth, I see no reason why static methods cannot be called from ob

Re: [PHP-DEV] Re: Static weirdness..

2004-02-21 Thread Art Hundiak
On Friday 20 February 2004 20:23, Herr Witten wrote: > Well, calling a static method from an instance breaks down the logic. > If it is static, then the instance has absolutely no bearing when > calling it. Therefore, it logically makes sense to call only from the > class name. > > Moreover, making

Re: [PHP-DEV] Re: Static weirdness..

2004-02-20 Thread Herr Witten
Well, calling a static method from an instance breaks down the logic. If it is static, then the instance has absolutely no bearing when calling it. Therefore, it logically makes sense to call only from the class name. Moreover, making a distinction between the method calling syntax begins to m

Re: [PHP-DEV] Re: Static weirdness..

2004-02-20 Thread Cristiano Duarte
On Wed, 18 Feb 2004 17:37:31 +, Wez Furlong wrote: > C++ allows $a->bar() when bar() is a static method (yes, it is called > in a static context there too). > > IMO, there should be no error, warning or notice here. > I Agree. PHP is fine the way it is. Cristiano Duarte -- PHP Internals -

Re: [PHP-DEV] Re: Static weirdness..

2004-02-20 Thread Zeev Suraski
At 17:21 19/02/2004, Marcus Boerger wrote: calling a static method from anywhere is absolutley fine. This of course includes calling a static method of an instance's class, however that is syntactically accomplished. That's exactly correct. Zeev -- PHP Internals - PHP Runtime Development Mailing

Re: [PHP-DEV] Re: Static weirdness..

2004-02-20 Thread Zeev Suraski
At 19:37 18/02/2004, Wez Furlong wrote: C++ allows $a->bar() when bar() is a static method (yes, it is called in a static context there too). IMO, there should be no error, warning or notice here. Same here. Zeev -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http:

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Marcus Boerger
Hello Pierre-Alain, Thursday, February 19, 2004, 4:28:50 PM, you wrote: > On Thu, 19 Feb 2004 16:21:50 +0100 > Marcus Boerger <[EMAIL PROTECTED]> wrote: >> But why the hell do you want a message, calling a static method from >> anywhere is absolutley fine. This of course includes calling a stati

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Hartmut Holzgraefe
Pierre-Alain Joye wrote: And PEAR does not lead PHP devs but the counter, imho. it_sure_doesnt (althoughItWouldLikeTo) ;) -- Hartmut Holzgraefe <[EMAIL PROTECTED]> -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Pierre-Alain Joye
On Thu, 19 Feb 2004 16:21:50 +0100 Marcus Boerger <[EMAIL PROTECTED]> wrote: > But why the hell do you want a message, calling a static method from > anywhere is absolutley fine. This of course includes calling a static > method of an instance's class, however that is syntactically > accomplished.

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Marcus Boerger
Hello Hans, Thursday, February 19, 2004, 4:14:53 PM, you wrote: > Timm Friebe wrote: >> On Wed, 2004-02-18 at 18:40, Hans Lellelid wrote: >> >>>foreach($entities as $ent) { >>> $peer = $ent->getPeer(); // e.g. might be BookPeer >>> $peer->doSelect(new Criteria()); //static: BookPeer::do

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Marcus Boerger
Hello Pierre-Alain, Thursday, February 19, 2004, 4:10:09 PM, you wrote: > On Thu, 19 Feb 2004 16:02:10 +0100 (CET) > Derick Rethans <[EMAIL PROTECTED]> wrote: >> But it should get set in non-static methods...which doesn't happen now >> :) > $this is set in non static methods if the method is ca

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Hans Lellelid
Timm Friebe wrote: On Wed, 2004-02-18 at 18:40, Hans Lellelid wrote: foreach($entities as $ent) { $peer = $ent->getPeer(); // e.g. might be BookPeer $peer->doSelect(new Criteria()); //static: BookPeer::doSelect() } $m= new Reflection_Method($ent->getPeer(), 'doSelect'); $m->invok

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Greg Beaver
Pierre-Alain Joye wrote: One sure thing, $this should not be set in static methods. I completely agree - the headache of fixing PEAR's "kind of static" methods is really annoying, and not really fixable. A method should either be static, non-static, or split into two methods, one that is st

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Pierre-Alain Joye
On Thu, 19 Feb 2004 16:02:10 +0100 (CET) Derick Rethans <[EMAIL PROTECTED]> wrote: > But it should get set in non-static methods...which doesn't happen now > :) $this is set in non static methods if the method is called from an instance of the object and not set if called statically. It's exactly

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Hartmut Holzgraefe
Pierre-Alain Joye wrote: One sure thing, $this should not be set in static methods. ACK -- Hartmut Holzgraefe <[EMAIL PROTECTED]> -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Hartmut Holzgraefe
Marcus Boerger wrote: A static and a non static member function are two absolute completley different things. sure they are (in certain ways), but when *calling* them (from a class users point of view, not an implementors point of view) the only difference is that the static member is guaranteed t

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Derick Rethans
On Thu, 19 Feb 2004, Pierre-Alain Joye wrote: > On Thu, 19 Feb 2004 15:49:42 +0100 > Marcus Boerger <[EMAIL PROTECTED]> wrote: > > > A static and a non static member function are two absolute completley > > different things. Anyway calling a static method from an instance as > > $instance->staticm

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Pierre-Alain Joye
On Thu, 19 Feb 2004 15:49:42 +0100 Marcus Boerger <[EMAIL PROTECTED]> wrote: > A static and a non static member function are two absolute completley > different things. Anyway calling a static method from an instance as > $instance->staticmethod() or $instance::staticmethod() should be > allowed.

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Marcus Boerger
Hello Hartmut, Thursday, February 19, 2004, 10:03:33 AM, you wrote: > Greg Beaver wrote: >> Hi, >> >> I agree that allowing $a->bar() with a static method is too confusing, >> and should not be allowed. However, the ability to call a static method >> of an object (variable class name, in othe

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Timm Friebe
On Wed, 2004-02-18 at 18:40, Hans Lellelid wrote: > Hi - [...] > foreach($entities as $ent) { > $peer = $ent->getPeer(); // e.g. might be BookPeer > $peer->doSelect(new Criteria()); //static: BookPeer::doSelect() > } $m= new Reflection_Method($ent->getPeer(), 'doSelect'); $m->invoke(NU

[PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Stephane Drouard
== Quote from Greg Beaver ([EMAIL PROTECTED])'s article > class foo { > static function bar() > { > echo 'hello'; > } > } > > $bar = 'hello'; > $a = new foo; > $a->bar(); // this could be disabled to error out easily > $a::bar(); // my patch now allows this to print "hello" >

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Lukas Smith
Hartmut Holzgraefe wrote: Greg Beaver wrote: Hi, I agree that allowing $a->bar() with a static method is too confusing, and should not be allowed. However, the ability to call a static method of an object (variable class name, in other words), is invaluable. What if PHP simply allowed $objec

Re: [PHP-DEV] Re: Static weirdness..

2004-02-19 Thread Hartmut Holzgraefe
Greg Beaver wrote: Hi, I agree that allowing $a->bar() with a static method is too confusing, and should not be allowed. However, the ability to call a static method of an object (variable class name, in other words), is invaluable. What if PHP simply allowed $object::staticMethod() syntax? W

[PHP-DEV] Re: Static weirdness..

2004-02-18 Thread Greg Beaver
Hi, I agree that allowing $a->bar() with a static method is too confusing, and should not be allowed. However, the ability to call a static method of an object (variable class name, in other words), is invaluable. What if PHP simply allowed $object::staticMethod() syntax? I did some playing

Re: [PHP-DEV] Re: Static weirdness..

2004-02-18 Thread Ferdinand Beyer
On 18 Feb 2004 at 12:33, John Coggeshall wrote: > No. There is *no* reason why static methods should be called from an > object context. Doing so is more than a notice -- its flat out wrong and > defeats the entire purpose of having static in the first place... I agree with John. I would even

Re: [PHP-DEV] Re: Static weirdness..

2004-02-18 Thread Hans Lellelid
Hi - Pierre-Alain Joye wrote: On Wed, 18 Feb 2004 12:23:04 -0500 John Coggeshall <[EMAIL PROTECTED]> wrote: class foo { static function bar() { } } $a = new foo(); $a->bar(); /* Unacceptable and contradictory to the concept of static */ foo::bar(); /* Acceptable */ I have the sam

Re: [PHP-DEV] Re: Static weirdness..

2004-02-18 Thread Pierre-Alain Joye
On Wed, 18 Feb 2004 12:33:35 -0500 John Coggeshall <[EMAIL PROTECTED]> wrote: > No. There is *no* reason why static methods should be called from an > object context. Doing so is more than a notice -- its flat out wrong > and defeats the entire purpose of having static in the first place... I on

Re: [PHP-DEV] Re: Static weirdness..

2004-02-18 Thread Wez Furlong
C++ allows $a->bar() when bar() is a static method (yes, it is called in a static context there too). IMO, there should be no error, warning or notice here. --Wez. > > class foo { > > static function bar() { > > } > > } > > $a = new foo(); > > $a->bar(); /* Unacceptable and contradictory to the

Re: [PHP-DEV] Re: Static weirdness..

2004-02-18 Thread Pierre-Alain Joye
On Wed, 18 Feb 2004 12:14:04 -0500 John Coggeshall <[EMAIL PROTECTED]> wrote: > if I download a new class from some site, or otherwise use someone > else's code, how do I know other than digging through the source on > a method's context? If $this isn't set I can't do the check, and if > then engi

Re: [PHP-DEV] Re: Static weirdness..

2004-02-18 Thread John Coggeshall
On Wed, 2004-02-18 at 12:30, Pierre-Alain Joye wrote: > We are talking about the same thing. A notice (error sounds too > drastic here) should be raised if a static method is called from the > instanciated object. No. There is *no* reason why static methods should be called from an object context

Re: [PHP-DEV] Re: Static weirdness..

2004-02-18 Thread Pierre-Alain Joye
On Wed, 18 Feb 2004 12:23:04 -0500 John Coggeshall <[EMAIL PROTECTED]> wrote: > class foo { > static function bar() { > } > } > $a = new foo(); > $a->bar(); /* Unacceptable and contradictory to the concept of static > */ foo::bar(); /* Acceptable */ I have the same problem as George :

Re: [PHP-DEV] Re: Static weirdness..

2004-02-18 Thread John Coggeshall
On Wed, 2004-02-18 at 12:21, George Schlossnagle wrote: > Maybe I'm having a slow-English day, but how is the first sentence here > is not intrinsically self-contradictory? :) class foo { static function bar() { } } $a = new foo(); $a->bar(); /* Unacceptable and contradictory t

Re: [PHP-DEV] Re: Static weirdness..

2004-02-18 Thread George Schlossnagle
On Feb 18, 2004, at 12:14 PM, John Coggeshall wrote: This is a completely acceptable thing, and it is IMO completely wrong to even allow in the engine. foo::bar() should be the only accepted syntax for static functions. Maybe I'm having a slow-English day, but how is the first sentence here is no

Re: [PHP-DEV] Re: Static weirdness..

2004-02-18 Thread John Coggeshall
> imho, this is the expected behavior. At least a notice should be raised. > I do not see a reason to define $this if a method is explicitly defined > as static (means it should not be called dynamically). Declare the > same funciton as public|private|protected and everything works fine. There is

[PHP-DEV] Re: Static weirdness..

2004-02-18 Thread Pierre-Alain Joye
On Wed, 18 Feb 2004 02:53:50 -0500 [EMAIL PROTECTED] (John Coggeshall) wrote: > http://bugs.php.net/bug.php?id=27304 > > Marcus says he's brought this up before, and i think it really needs > to be addressed before PHP 5 so I'm bringing it up again. I am told > that currently we are allowing stat