Re: [RFC][VOTE] Default parent constructors RFC

From: Date: Sun, 11 Jan 2015 02:08:35 +0000
Subject: Re: [RFC][VOTE] Default parent constructors RFC
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-80342@lists.php.net to get a copy of this message
Hi Stas, On Sun, Jan 11, 2015 at 9:34 AM, Stanislav Malyshev <smalyshev@gmail.com> wrote: > I'd like to initiate a vote on this RFC: > https://wiki.php.net/rfc/default_ctor > > TLDR: this RFC would make a call to parent::__construct() succeed (as in > "not produce a fatal error") even if the parent class does not define a > ctor. Same for __destruct and __clone. The motivation for it is in the > RFC and here: > https://php100.wordpress.com/2014/11/04/default-constructors/ > > I've chosen the simplest way of implementing it, as suggested by Dmitry, > in https://github.com/php/php-src/pull/990. There are other > alternatives, but I think the simpler the better. > > Previous discussion is at: > http://marc.info/?t=141630266000001&r=2&w=2 > Nice RFC. It covers __clone(), __destruct() also. This would be great for rapid prototyping. Small comment to the patch. + (strcasecmp(Z_STRVAL_P(function_name), ZEND_DESTRUCTOR_FUNC_NAME) == 0 || + strcasecmp(Z_STRVAL_P(function_name), ZEND_CONSTRUCTOR_FUNC_NAME) == 0 || + strcasecmp(Z_STRVAL_P(function_name), ZEND_CLONE_FUNC_NAME) == 0)) { The comparison order would be better + (strcasecmp(Z_STRVAL_P(function_name), ZEND_CONSTRUCTOR_FUNC_NAME) == 0 || + strcasecmp(Z_STRVAL_P(function_name), ZEND_CLONE_FUNC_NAME) == 0 || + strcasecmp(Z_STRVAL_P(function_name), ZEND_DESTRUCTOR_FUNC_NAME) == 0)) { I suppose default constructor is used most, then clone, destructor. It depends on a script, though. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net

« previous php.internals (#80342) next »