Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Tjerk Meesters
On Sep 20, 2011 2:10 AM, wrote: > > Hi! > > I followed the whole discussion, still it is not clear which one is > considered good and which bad practice... > > In ZF 1 and 2, ZendRegistry::__construct() has the following signature with > 2 parameters: > > function __construct($array = array(), $fl

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread devis
Hi! I followed the whole discussion, still it is not clear which one is considered good and which bad practice... In ZF 1 and 2, ZendRegistry::__construct() has the following signature with 2 parameters: function __construct($array = array(), $flags = parent::ARRAY_AS_PROPS) while SPL ArrayObje

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Ferenc Kovacs
First of all, Anthony, thanks for joining into the discussion! >> With respect to the func_get_args argument, I see that as a non-issue. >>  Sure, you can do it.  But if you do, you're lying about the >> interface.  You're telling the callers that you expect no arguments, >> but then all of a sudd

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, On Mon, Sep 19, 2011 at 16:26, Anthony Ferrara wrote: > Hello all, > > I purposely tried to stay out of this conversation, but seeing as > there's a lot of information flying around I think I'll give my > $0.02... > > As far as the Square-Rectangle example, that is a classic violation of > t

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Anthony Ferrara
Hello all, I purposely tried to stay out of this conversation, but seeing as there's a lot of information flying around I think I'll give my $0.02... As far as the Square-Rectangle example, that is a classic violation of the LSP. In fact, it's unsolvable using inheritance. For information as to

[PHP-DEV] Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_4/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c

2011-09-19 Thread Johannes Schlüter
On Mon, 2011-09-19 at 12:25 +0200, Ferenc Kovacs wrote: > > > > Good point, are you proposing to change code and make libmysql 5.0+ a > > requirement? If so, several changes should be made to ext/mysql, ext/mysqli > > and PDO_MySQL. > > > > I think that it is your call, but yes, I think it would r

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Laruence
2011/9/19 Etienne Kneuss : > Hi, > > On Mon, Sep 19, 2011 at 12:40, Etienne Kneuss wrote: > >> Hi, >> >> On Mon, Sep 19, 2011 at 12:18, Gustavo Lopes wrote: >> >>> Em Mon, 19 Sep 2011 10:56:03 +0100, Etienne Kneuss >>> escreveu: >>> >>> >>> Apparently you guys are speaking about the initial

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, On Mon, Sep 19, 2011 at 12:40, Etienne Kneuss wrote: > Hi, > > On Mon, Sep 19, 2011 at 12:18, Gustavo Lopes wrote: > >> Em Mon, 19 Sep 2011 10:56:03 +0100, Etienne Kneuss >> escreveu: >> >> >> >>> Apparently you guys are speaking about the initial implementation of an >>> abstract method, w

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, On Mon, Sep 19, 2011 at 12:18, Gustavo Lopes wrote: > Em Mon, 19 Sep 2011 10:56:03 +0100, Etienne Kneuss > escreveu: > > > >> Apparently you guys are speaking about the initial implementation of an >> abstract method, while I was talking about overriding a method, which is >> not the relly

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Gustavo Lopes
Em Mon, 19 Sep 2011 11:20:56 +0100, Pierre Joye escreveu: On Mon, Sep 19, 2011 at 12:18 PM, Gustavo Lopes wrote: http://www.google.com/codesearch#HmA4mAI_aLc/src/main/java/terrastore/server/impl/support/JsonBucketsProvider.java&q=implements%5C%20MessageBodyWriter&type=cs&l=36 This is the

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
On Mon, Sep 19, 2011 at 11:50, Gustavo Lopes wrote: > Em Mon, 19 Sep 2011 10:18:50 +0100, Stas Malyshev > escreveu: > > On 9/19/11 2:12 AM, Gustavo Lopes wrote: >> >>> Arbitrary as it may be, it's nevertheless reasonably arbitrated given how >>> little useful it is to just ignore arguments and

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Ferenc Kovacs
On Mon, Sep 19, 2011 at 12:20 PM, Pierre Joye wrote: > On Mon, Sep 19, 2011 at 12:18 PM, Gustavo Lopes > wrote: > http://www.google.com/codesearch#HmA4mAI_aLc/src/main/java/terrastore/server/impl/support/JsonBucketsProvider.java&q=implements%5C%20MessageBodyWriter&type=cs&l=36 >> >> This is the

[PHP-DEV] Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/mysqli/mysqli_api.c branches/PHP_5_4/ext/mysqli/mysqli_api.c trunk/ext/mysqli/mysqli_api.c

2011-09-19 Thread Ferenc Kovacs
> > Good point, are you proposing to change code and make libmysql 5.0+ a > requirement? If so, several changes should be made to ext/mysql, ext/mysqli > and PDO_MySQL. > I think that it is your call, but yes, I think it would reasonable, and it would make our/your work much easier if we would hav

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Pierre Joye
On Mon, Sep 19, 2011 at 12:18 PM, Gustavo Lopes wrote: http://www.google.com/codesearch#HmA4mAI_aLc/src/main/java/terrastore/server/impl/support/JsonBucketsProvider.java&q=implements%5C%20MessageBodyWriter&type=cs&l=36 > > This is the most common scenario for implementations of this interface (see

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Gustavo Lopes
Em Mon, 19 Sep 2011 10:56:03 +0100, Etienne Kneuss escreveu: Apparently you guys are speaking about the initial implementation of an abstract method, while I was talking about overriding a method, which is not the relly same. So the above doesn't really apply. The initial implementation

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, 2011/9/19 Frédéric Hardy > Hi ! > > >> You misunderstand what LSP means. It does not mean "overriding methods >> should have same signatures", it means "overriding methods should accept any >> data that base method accepts". It never says it can not accept any other >> data. >> > Idem. > So

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Frédéric Hardy
Hi ! You misunderstand what LSP means. It does not mean "overriding methods should have same signatures", it means "overriding methods should accept any data that base method accepts". It never says it can not accept any other data. Idem. So you can have : class A { public function f($a) {

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Ferenc Kovacs
On Mon, Sep 19, 2011 at 11:55 AM, Gustavo Lopes wrote: > Em Mon, 19 Sep 2011 10:35:47 +0100, Ferenc Kovacs > escreveu: > >> could you check my second(lengthy) mail on this thread? >> I also tried to come up with the valid, and invalid signature changes. >> I forget to take references into account

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Pierre Joye
On Mon, Sep 19, 2011 at 11:56 AM, Etienne Kneuss wrote: >> There is a precondition that the abstract method enforces in such >> prototypes, and it is: >> - I will require at least X arguments >> if a method implements this and defines the prototype with: >> - I will require at least Y arguments w

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, On Mon, Sep 19, 2011 at 11:28, Etienne Kneuss wrote: > Hi, > > On Mon, Sep 19, 2011 at 11:19, Pierre Joye wrote: > >> On Mon, Sep 19, 2011 at 11:12 AM, Stas Malyshev >> wrote: >> > Hi! >> > >> > On 9/19/11 2:02 AM, Pierre Joye wrote: >> >> >> >> Sorry but your constantly rejecting any logi

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Richard Quadling
On 19 September 2011 10:17, Etienne Kneuss wrote: > Hi, > > 2011/9/19 Frédéric Hardy > >> Hi ! >> >> What is the utility of abstract method if implementation can not follow >> the signature (constraints ?) of the abstract method ? >> > In this case, abstract methods are totaly useless ! >> Moreov

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Ferenc Kovacs
On Mon, Sep 19, 2011 at 11:32 AM, Gustavo Lopes wrote: > Em Mon, 19 Sep 2011 10:18:50 +0100, Stas Malyshev > escreveu: > >> On 9/19/11 2:12 AM, Gustavo Lopes wrote: >>> >>> Arbitrary as it may be, it's nevertheless reasonably arbitrated given how >>> little useful it is to just ignore arguments a

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Gustavo Lopes
Em Mon, 19 Sep 2011 10:18:50 +0100, Stas Malyshev escreveu: On 9/19/11 2:12 AM, Gustavo Lopes wrote: Arbitrary as it may be, it's nevertheless reasonably arbitrated given how little useful it is to just ignore arguments and how likely it is to a mistake. It is not little useful and it is

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Ferenc Kovacs
On Mon, Sep 19, 2011 at 10:40 AM, Gustavo Lopes wrote: > Em Sun, 18 Sep 2011 20:06:31 +0100, Stas Malyshev > escreveu: > >> On 9/18/11 11:23 AM, Nikita Popov wrote: >>> >>> to tell you: I need this and that method accepting these and these >>> arguments to work correctly. If the signature isn't e

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Gustavo Lopes
Em Mon, 19 Sep 2011 10:18:50 +0100, Stas Malyshev escreveu: On 9/19/11 2:12 AM, Gustavo Lopes wrote: Arbitrary as it may be, it's nevertheless reasonably arbitrated given how little useful it is to just ignore arguments and how likely it is to a mistake. It is not little useful and it is

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Ferenc Kovacs
On Mon, Sep 19, 2011 at 11:12 AM, Gustavo Lopes wrote: > Em Mon, 19 Sep 2011 10:01:32 +0100, Etienne Kneuss > escreveu: > >> Sure, but you mix two things here, references would have to be handled >> specifically, and we would not allow to specify less args by ref. >> >> There is simply no reason

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, On Mon, Sep 19, 2011 at 11:19, Pierre Joye wrote: > On Mon, Sep 19, 2011 at 11:12 AM, Stas Malyshev > wrote: > > Hi! > > > > On 9/19/11 2:02 AM, Pierre Joye wrote: > >> > >> Sorry but your constantly rejecting any logical, documented, known > >> principles for the abstract concept is killin

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Pierre Joye
On Mon, Sep 19, 2011 at 11:12 AM, Stas Malyshev wrote: > Hi! > > On 9/19/11 2:02 AM, Pierre Joye wrote: >> >> Sorry but your constantly rejecting any logical, documented, known >> principles for the abstract concept is killing me. > > I didn't see any documented principle that say the code I cited

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Stas Malyshev
Hi! On 9/19/11 2:12 AM, Gustavo Lopes wrote: Arbitrary as it may be, it's nevertheless reasonably arbitrated given how little useful it is to just ignore arguments and how likely it is to a mistake. It is not little useful and it is not likely to make such mistake without immediately being no

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, 2011/9/19 Frédéric Hardy > Hi ! > > What is the utility of abstract method if implementation can not follow > the signature (constraints ?) of the abstract method ? > In this case, abstract methods are totaly useless ! > Moreover, i think that it's not compatible with Liskov substitution > p

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Stas Malyshev
Hi! On 9/19/11 2:05 AM, Frédéric Hardy wrote: What is the utility of abstract method if implementation can not follow the signature (constraints ?) of the abstract method ? In this case, abstract methods are totaly useless ! Moreover, i think that it's not compatible with Liskov substitution pri

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Frédéric Hardy
Hi ! What is the utility of abstract method if implementation can not follow the signature (constraints ?) of the abstract method ? In this case, abstract methods are totaly useless ! Moreover, i think that it's not compatible with Liskov substitution principle. Best regards, Fred -- ==

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Gustavo Lopes
Em Mon, 19 Sep 2011 10:01:32 +0100, Etienne Kneuss escreveu: Sure, but you mix two things here, references would have to be handled specifically, and we would not allow to specify less args by ref. There is simply no reason for disallowing this with nornal args though. Imagine the following

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Stas Malyshev
Hi! On 9/19/11 2:02 AM, Pierre Joye wrote: Sorry but your constantly rejecting any logical, documented, known principles for the abstract concept is killing me. I didn't see any documented principle that say the code I cited is prohibited. Only example you brought so far is C function declara

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Frédéric Hardy
Hi ! What is the utility of abstract method if implementation can not follow the signature (constraints ?) of the abstract method ? In this case, abstract methods are totaly useless ! Moreover, i think that it's not compatible with Liskov substitution principle (http://en.wikipedia.org/wiki/Li

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Stas Malyshev
Hi! On 9/19/11 1:40 AM, Gustavo Lopes wrote: If the subclass method specifies less parameters, it is very likely a mistake. It's not usual (certainly it's not more frequent than a mistake Why would it always be? I had code where overriding class had methods that need less arguments and substi

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Pierre Joye
On Mon, Sep 19, 2011 at 10:46 AM, Stas Malyshev wrote: > Please do not assume I disagree with you because I am unable to understand > you. I understand you perfectly well and you are wrong. Sorry but your constantly rejecting any logical, documented, known principles for the abstract concept is

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Etienne Kneuss
Hi, On Mon, Sep 19, 2011 at 10:40, Gustavo Lopes wrote: > Em Sun, 18 Sep 2011 20:06:31 +0100, Stas Malyshev > escreveu: > > On 9/18/11 11:23 AM, Nikita Popov wrote: >> >>> to tell you: I need this and that method accepting these and these >>> arguments to work correctly. If the signature isn't

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Stas Malyshev
Hi! On 9/19/11 1:33 AM, Pierre Joye wrote: It is the same in C. A class extending an abstract class (or method) does not extend it per se but implement it. Just like the foo(int a, float b); is the declaration (abstract) and foo(int a, float b) { return a * b;= the extended class. This is the ba

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Gustavo Lopes
Em Sun, 18 Sep 2011 20:06:31 +0100, Stas Malyshev escreveu: On 9/18/11 11:23 AM, Nikita Popov wrote: to tell you: I need this and that method accepting these and these arguments to work correctly. If the signature isn't enforced, this doesn't make sense anymore. You could just as well drop t

Re: [PHP-DEV] __constructor parameter limitations.

2011-09-19 Thread Pierre Joye
On Mon, Sep 19, 2011 at 3:00 AM, Stas Malyshev wrote: > Hi! > > On 9/18/11 5:42 PM, Pierre Joye wrote: >> >> But this exact example works, only the similar case using abstract >> will fail, and it makes to fail here as an abstract method is only the > > It produces E_STRICT for regular functions,