Re: Re: Why isn't base class constructors or destructors required to be called? (was: Re: [PHP-DEV] Return type hints)
| From: | Terje Slettebø | Date: | Fri, 15 Sep 2006 06:33:05 +0000 |
| Subject: | Re: Re: Why isn't base class constructors or destructors required to be called? (was: Re: [PHP-DEV] Return type hints) | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-25715@lists.php.net to get a copy of this message | ||
> >> When would the constructor be called automatically? I've used Delphi
> >> and you use the inherit verb (or inherited - long time ago - can't
> >> remember exactly). In PHP parent::__construct (though I think
> >> parent::__METHOD__ would be cleaner as this removes ambiguity on the
> >> actual name for all inherited methods).
>
> > Well, let's look at C++, which I'm most familiar with.
>
> PHP is not C++
Ah, I was kind of waiting for that one... :) Yet, that says absolutely
nothing about why PHP works the way it does.
> and speaking of constructors and destrcutors PHP goes morethe Delphi way.
If constructors/destructors are not "the PHP way", then why even have them?
> We do not claim to follow any other language precisely, PHP is
> it's own language with its own feature set.
Naturally, but is it unreasonable to think that there's a reason for the way
things work in PHP...? And to ask _why_ PHP doesn't let you ensure that a
class has its constructor/destructor called? Why implement
constructors/destructors in such a way that they may - or may not - be
called? "Do you feel lucky?"
Regards,
Terje