Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Marcus Boerger
Hello Timm, Friday, February 27, 2004, 7:39:26 PM, you wrote: > On Fri, 2004-02-27 at 14:39, Stig S. Bakken wrote: >> On Fri, 2004-02-27 at 14:13, Derick Rethans wrote: > [...] >> What is worse is that many PHP 4 APIs need to be completely redesigned >> for PHP 5, not only the guts of the class.

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Timm Friebe
On Fri, 2004-02-27 at 14:39, Stig S. Bakken wrote: > On Fri, 2004-02-27 at 14:13, Derick Rethans wrote: [...] > What is worse is that many PHP 4 APIs need to be completely redesigned > for PHP 5, not only the guts of the class. > > IMHO method overloading the the only clean way out of this. Agre

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Andrei Zmievski
On Fri, 27 Feb 2004, Andi Gutmans wrote: > What I suggest is the following: > a) Don't check signature for constructors. > b) By default, don't check signature for inheritance *if* we're not > inheriting from an abstract class. If it is an abstract class we should > check the signature because it

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Derick Rethans
On Fri, 27 Feb 2004, Andi Gutmans wrote: > At 14:13 27/02/2004 +0100, Derick Rethans wrote: > >On Fri, 27 Feb 2004, Andi Gutmans wrote: > > > > > d) Last problem is that using E_STRICT is not a good idea because we find > > > this problem at compile-time and the error_reporting might not be set ye

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread George Schlossnagle
On Feb 27, 2004, at 10:05 AM, Andi Gutmans wrote: Yeah but people are used to setting the error_reporting from prepend's or at the beginning of the script. But you know what, I guess we can live with this because I see a few E_WARNINGS at the compile stage. So I guess we could go with E_STRICT f

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Andi Gutmans
At 14:13 27/02/2004 +0100, Derick Rethans wrote: On Fri, 27 Feb 2004, Andi Gutmans wrote: > d) Last problem is that using E_STRICT is not a good idea because we find > this problem at compile-time and the error_reporting might not be set yet. The INI system is 'booted' before the script is compile

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Stig S. Bakken
On Fri, 2004-02-27 at 14:13, Derick Rethans wrote: > On Fri, 27 Feb 2004, Andi Gutmans wrote: > > > d) Last problem is that using E_STRICT is not a good idea because we find > > this problem at compile-time and the error_reporting might not be set yet. > > The INI system is 'booted' before the sc

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Michael Walter
George Schlossnagle wrote: On Feb 27, 2004, at 4:12 AM, Andi Gutmans wrote: Hey, I'd like to come to some conclusion about the latest changes which break BC (trying to keep it short because some people here wrote long essays and it took me too much time to catch up :) : a) I agree that it does

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread George Schlossnagle
On Feb 27, 2004, at 4:12 AM, Andi Gutmans wrote: Hey, I'd like to come to some conclusion about the latest changes which break BC (trying to keep it short because some people here wrote long essays and it took me too much time to catch up :) : a) I agree that it doesn't make much sense for con

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Derick Rethans
On Fri, 27 Feb 2004, Andi Gutmans wrote: > d) Last problem is that using E_STRICT is not a good idea because we find > this problem at compile-time and the error_reporting might not be set yet. The INI system is 'booted' before the script is compiled, so I doubt that this is a problem. > What I

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Patrick Schnorbus
On Friday 27 February 2004 11:12, Ferdinand Beyer wrote: > On 27 Feb 2004 at 10:58, Patrick Schnorbus wrote: > > Mhm. Does a signature make sense if the engine ignores it > > anyway? > > > For better readability one can use phpdoc/doxygen like comment > > blocks. > > That's right. But I don't see a

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Patrick Schnorbus
On Friday 27 February 2004 10:12, Andi Gutmans wrote: > What I suggest is the following: > a) Don't check signature for constructors. Okie ;) > b) By default, don't check signature for inheritance *if* we're not > inheriting from an abstract class. > If it is an abstract class we should > check

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Stephane Drouard
== Quote from Andi Gutmans ([EMAIL PROTECTED])'s article > a) Don't check signature for constructors. Constructors are definitely not virtual methods. So no reason to check signature. Moreover, this is a non sense to declare constructors in interfaces or abstract constructors in abstract classes.

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Ferdinand Beyer
On 27 Feb 2004 at 10:58, Patrick Schnorbus wrote: > Mhm. Does a signature make sense if the engine ignores it anyway? > For better readability one can use phpdoc/doxygen like comment blocks. That's right. But I don't see a reason why we should disallow to use a signature in an interface declar

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Patrick Schnorbus
On Friday 27 February 2004 10:41, Ferdinand Beyer wrote: > On 27 Feb 2004 at 11:12, Andi Gutmans wrote: > > Comments? (Please try to keep them short :) > > I think we should just drop the signature check. Interfaces may > include a signature for better readability but the engine should ignore > the

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Stanislav Malyshev
AG>> c) Add a new INI option (zend.strict_inheritance_checks) which AG>> does check signature for methods (except for constructor). I AG>> don't like new INI options but I don't think there's any way AG>> out. There's a dilemma about this option. On one hand, it should be on by default. Otherwise,

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Ferdinand Beyer
On 27 Feb 2004 at 11:12, Andi Gutmans wrote: > Comments? (Please try to keep them short :) I think we should just drop the signature check. Interfaces may include a signature for better readability but the engine should ignore them. PHP4 class trees work fine even without strict inheritance ch

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-27 Thread Andi Gutmans
Hey, I'd like to come to some conclusion about the latest changes which break BC (trying to keep it short because some people here wrote long essays and it took me too much time to catch up :) : a) I agree that it doesn't make much sense for constructors, because one always creates concrete cl

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-26 Thread Hans Lellelid
Ferdinand Beyer wrote: IMO we are trying to force a strict programming here that is incompatible with PHP's loose character. Yeah, I absolutely agree with that. The more I think about it the more it also seems like this change is going to break a *lot* of PHP code out there. Especially the e

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-26 Thread Andrey Hristov
Marcus Boerger wrote: Hello Timm, i had the same expirience today too. And also for me it makes not much sense. The constructor shouldn't check inheritance rules. And as a consequence maybe interfaces shouldn't allow constructors. Does inheritance include visibility rules? ;) Andrey -- PHP Inter

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-26 Thread Jeff Moore
On Feb 26, 2004, at 1:49 AM, Andi Gutmans wrote: You are breaking the isA relationship. We fixed this so that from now on, people will not make such mistakes anymore (I think it's the right way to go, so that we don't leave broken functionality around). You can enable compatibility mode to make

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-26 Thread Marcus Boerger
Hello Andrey, Thursday, February 26, 2004, 1:08:19 PM, you wrote: > Marcus Boerger wrote: >> Hello Timm, >> >> i had the same expirience today too. And also for me it makes not much >> sense. The constructor shouldn't check inheritance rules. And as a >> consequence maybe interfaces shouldn't al

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-26 Thread Zeev Suraski
At 03:28 26/02/2004, Derick Rethans wrote: On Thu, 26 Feb 2004, Marcus Boerger wrote: > Hello Timm, > > well for normal methods we must do that. The derived class must support the > same signature that the base class supports. In you example that would only > work if the derived method would have

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-26 Thread Zeev Suraski
At 07:19 26/02/2004, Hans Lellelid wrote: Ferdinand Beyer wrote: IMO we are trying to force a strict programming here that is incompatible with PHP's loose character. Yeah, I absolutely agree with that. The more I think about it the more it also seems like this change is going to break a *lot*

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-26 Thread George Schlossnagle
On Feb 26, 2004, at 11:49 PM, Zeev Suraski wrote: At 07:19 26/02/2004, Hans Lellelid wrote: Ferdinand Beyer wrote: IMO we are trying to force a strict programming here that is incompatible with PHP's loose character. Yeah, I absolutely agree with that. The more I think about it the more it als

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-26 Thread Adam Maccabee Trachtenberg
On Fri, 27 Feb 2004, George Schlossnagle wrote: > This is an enormously huge bc break. Error-prone or not, I would wager > that 95%+ of all php4 OO code exploits the ability to redefine the > signature on inherited methods. So far, I've identified that this breaks more than one important PEAR pa

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-26 Thread Michael Walter
Ferdinand Beyer wrote: IMO we are trying to force a strict programming here that is incompatible with PHP's loose character. Well, I don't get the point in relation to *constructors* at all.. I mean, forcing the same signature for each constructor seems unreasonable to me (_when explicitely cal

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-26 Thread Ferdinand Beyer
IMO we are trying to force a strict programming here that is incompatible with PHP's loose character. The following example for instance is very common in Java AVT programming: Furthermore with the new implementation we disallow "the PHP way for overloaded methods" using a variable parameter

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-26 Thread Derick Rethans
On Thu, 26 Feb 2004, Marcus Boerger wrote: > Hello Timm, > > well for normal methods we must do that. The derived class must support the > same signature that the base class supports. In you example that would only > work if the derived method would have a default parameter for the additional > pa

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-26 Thread Derick Rethans
On Thu, 26 Feb 2004, Timm Friebe wrote: > On Thu, 2004-02-26 at 01:38, Marcus Boerger wrote: > > Hello Timm, > [...] > > > Should work #1, Bar::connect() adds an argument > > No the sugnature is incompatible. An instance of Foo cannot be called > > with Bar or Connector's connect() Signature. Henc

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-26 Thread Derick Rethans
On Thu, 26 Feb 2004, Andi Gutmans wrote: > At 18:54 25/02/2004 -0500, Hans Lellelid wrote: > >It seems now that PHP is no longer inconsistent, but it also seems that it > >is impossible to override methods w/ incompatible signature. Is that a > >correct assessment? This is a pretty big differenc

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Michael Walter
Timm Friebe wrote: [EMAIL PROTECTED]:~/devel/php/tests > cat inheritance.php class Foo { function __construct($foo) { } } class Bar extends Foo { function __construct($foo, $bar) { // Add = NULL after $bar to make it work } } ?> [EMAIL PROTECTED]:~/devel/php/te

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Andi Gutmans
At 08:03 26/02/2004 +0100, Timm Friebe wrote: On Thu, 2004-02-26 at 07:49, Andi Gutmans wrote: > At 23:36 25/02/2004 +0100, Timm Friebe wrote: [...] > Guys, > > You are breaking the isA relationship. We fixed this so that from now on, > people will not make such mistakes anymore (I think it's the r

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Timm Friebe
On Thu, 2004-02-26 at 07:49, Andi Gutmans wrote: > At 23:36 25/02/2004 +0100, Timm Friebe wrote: [...] > Guys, > > You are breaking the isA relationship. We fixed this so that from now on, > people will not make such mistakes anymore (I think it's the right way to > go, so that we don't leave br

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-25 Thread Andi Gutmans
At 18:54 25/02/2004 -0500, Hans Lellelid wrote: It seems now that PHP is no longer inconsistent, but it also seems that it is impossible to override methods w/ incompatible signature. Is that a correct assessment? This is a pretty big difference from PHP4, then. Personally, I can live with i

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Andi Gutmans
At 23:52 25/02/2004 +0100, Timm Friebe wrote: On Wed, 2004-02-25 at 23:44, Marcus Boerger wrote: > Hello Timm, > > i had the same expirience today too. And also for me it makes not much > sense. The constructor shouldn't check inheritance rules. Neither should other methods follow this. What if I w

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Andi Gutmans
At 23:36 25/02/2004 +0100, Timm Friebe wrote: [EMAIL PROTECTED]:~/devel/php/tests > cat inheritance.php class Bar extends Foo { function __construct($foo, $bar) { // Add = NULL after $bar to make it work } } ?> [EMAIL PROTECTED]:~/devel/php/tests > php-dev inheritance.php Fatal e

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Timm Friebe
On Thu, 2004-02-26 at 02:38, Marcus Boerger wrote: > Hello Timm, [...] > Yes! Maybe it would be good to apply the correct rules with E_COMPILE_ERROR > in cases where interfaces come into play and E_STRICT for compatibility mode > and non interfaces. Would that work for you? Yupp, that's perfect.

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Timm Friebe
On Thu, 2004-02-26 at 02:13, Timm Friebe wrote: > On Thu, 2004-02-26 at 01:38, Marcus Boerger wrote: > > Hello Timm, > [...] > > > Should work #1, Bar::connect() adds an argument > > No the sugnature is incompatible. An instance of Foo cannot be called > > with Bar or Connector's connect() Signatur

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Adam Maccabee Trachtenberg
On Thu, 26 Feb 2004, Marcus Boerger wrote: > well for normal methods we must do that. The derived class must support the > same signature that the base class supports. In you example that would only > work if the derived method would have a default parameter for the additional > parameter: > >

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Marcus Boerger
Hello Timm, Hello Zeev, please have a look at this thread. Obviously you started a huge BC break here. See my second comment on a possible way out. Thursday, February 26, 2004, 2:13:48 AM, you wrote: > On Thu, 2004-02-26 at 01:38, Marcus Boerger wrote: >> Hello Timm, > [...] >> > Should work #1,

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Timm Friebe
On Thu, 2004-02-26 at 01:38, Marcus Boerger wrote: > Hello Timm, [...] > > Should work #1, Bar::connect() adds an argument > No the sugnature is incompatible. An instance of Foo cannot be called > with Bar or Connector's connect() Signature. Hence Bar is not a Foo > or Connector. Hrm, that's quite

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Marcus Boerger
Hello Timm, Thursday, February 26, 2004, 12:34:31 AM, you wrote: > On Wed, 2004-02-25 at 23:52, Timm Friebe wrote: >> On Wed, 2004-02-25 at 23:44, Marcus Boerger wrote: >> > Hello Timm, >> > >> > i had the same expirience today too. And also for me it makes not much >> > sense. The constructor s

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible

2004-02-25 Thread Hans Lellelid
Timm Friebe wrote: On Wed, 2004-02-25 at 23:44, Marcus Boerger wrote: Hello Timm, i had the same expirience today too. And also for me it makes not much sense. The constructor shouldn't check inheritance rules. Neither should other methods follow this. What if I want to add a non-default parame

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Timm Friebe
On Wed, 2004-02-25 at 23:52, Timm Friebe wrote: > On Wed, 2004-02-25 at 23:44, Marcus Boerger wrote: > > Hello Timm, > > > > i had the same expirience today too. And also for me it makes not much > > sense. The constructor shouldn't check inheritance rules. > > Neither should other methods follow

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Marcus Boerger
Hello Timm, well for normal methods we must do that. The derived class must support the same signature that the base class supports. In you example that would only work if the derived method would have a default parameter for the additional parameter: regards marcus Wednesday, February 25, 20

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Timm Friebe
On Wed, 2004-02-25 at 23:44, Marcus Boerger wrote: > Hello Timm, > > i had the same expirience today too. And also for me it makes not much > sense. The constructor shouldn't check inheritance rules. Neither should other methods follow this. What if I want to add a non-default parameter to an ove

Re: [PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Marcus Boerger
Hello Timm, i had the same expirience today too. And also for me it makes not much sense. The constructor shouldn't check inheritance rules. And as a consequence maybe interfaces shouldn't allow constructors. marcus Wednesday, February 25, 2004, 11:36:57 PM, you wrote: > [EMAIL PROTECTED]:~/dev

[PHP-DEV] Declaration of Bar::__construct() must be compatible with that of Foo::__construct()

2004-02-25 Thread Timm Friebe
[EMAIL PROTECTED]:~/devel/php/tests > cat inheritance.php [EMAIL PROTECTED]:~/devel/php/tests > php-dev inheritance.php Fatal error: Declaration of Bar::__construct() must be compatible with that of Foo::__construct() in /usr/home/thekid/devel/php/tests/inheritance.php on line 10 Is this reall