On 24 May 2013 13:11, Ferenc Kovacs <tyr...@gmail.com> wrote:

> On Thu, May 23, 2013 at 11:32 PM, Stas Malyshev <smalys...@sugarcrm.com
> >wrote:
>
> > Hi!
> >
> > > Right now, to avoid this situation, you have to do:
> > > if (method_exists(get_parent_class(), '__construct'))
> > > parent::__construct();
> > >
> > > If you don't check for the method existing, you get:
> > > Fatal error: Cannot call constructor ...
> >
> > This makes a lot of sense. I think we also discussed this idea some time
> > ago, but it didn't go anywhere that time...
>
>
> last time it was discussed on the list:
> http://www.mail-archive.com/internals@lists.php.net/msg50504.html
> to summarize it:
> Etienne was arguing that for the concrete example (Spl classes) it would be
> better to make sure that the object is properly initialized so having a
> constructor in the spl classes.
> Anthony was the only one who was against the idea of removing the error
> when you call a parent constructor which doesn't (explicitly) have one.
> Otherwise everybody else seemed to agree with the above change and only the
> implementation was discussed:
> - we should remove the error completelly
> - we should make the error less serious (please don't do this)
> - we should always create a common ancestor for every class by default
> which have an empty constructor/destructor
> - we should always create an empty constructor/desctructor for every class
> without it.
>
> So maybe we could discuss this and based on the feedback create an rfc
> (with or without a vote for the alternative implementations).


Hi.

I'm not an expert here, so just thinking out loud ...

If a theoretical \PHP\baseclass can have empty __construct()/__destruct(),
what about the other magic methods?

OK, I suppose cascading some of the magic methods to a parent and having a
null parent at the very very bottom of the heap sounds useful. But I'm not
totally sure.

Is there much/any need for a true base class that ALL classes will extend
from, including those in extensions.

Richard.

-- 
Richard Quadling
Twitter : @RQuadling
EE : http://e-e.com/M_248814.html
Zend : http://bit.ly/9O8vFY

Reply via email to