Re: [citations for] Re: [PHP-DEV] Experiments with a threading library for Zend: spawning a new executor
| From: | Martin Scotta | Date: | Thu, 20 Jan 2011 14:25:36 +0000 |
| Subject: | Re: [citations for] Re: [PHP-DEV] Experiments with a threading library for Zend: spawning a new executor | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51335@lists.php.net to get a copy of this message | ||
Martin Scotta
On Wed, Jan 19, 2011 at 9:19 PM, Stas Malyshev <smalyshev@sugarcrm.com>wrote:
> Hi!
>
>
> Many PHP features should be language constructs, but they were made as
>> language hacks.
>>
>> __construct is evil, as like any other language hack
>>
>
> Constructors are standard feature in many languages. There's nothing evil
> in them.
>
>
> class Client {
>> function __construct() {
>> // some code
>> parent::__construct(); // as good client call the super class
>> // and then more code
>> }
>> }
>>
>
> Arguably, initialization is the part of the API, but I see your point - it
> might be useful to supply all objects with empty default ctor so that
> parent::__construct() always works. Submit a feature request to
> bugs.php.net.
>
>
and what what happen if the extending class does not call
parent::__construct() ?
__construct is just like any other function, but with semantic added on top
of.
Changing the way it behaves will cause many headaches
---
BTW, Did you noted that "self" keyword is allowed as method name? so I
belive it is not a keyword at all
class Foo{
function self() {
echo __METHOD__, PHP_EOL;
}
}
$foo = new Foo();
$foo->self();
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227
>