Martin Scotta

On Wed, Jan 19, 2011 at 9:19 PM, Stas Malyshev <smalys...@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
>

Reply via email to