Re: Explicit constructor call and polymorphic dispatch
| From: | Michał Brzuchalski | Date: | Sat, 14 Jan 2017 21:00:57 +0000 |
| Subject: | Re: Explicit constructor call and polymorphic dispatch | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-97757@lists.php.net to get a copy of this message | ||
2017-01-14 19:24 GMT+01:00 Fleshgrinder <php@fleshgrinder.com>:
> On 1/14/2017 7:10 PM, Michał Brzuchalski wrote:
> > AFAIK parent is a speciual scope which help refers to variables and
> > functions in base classe
> > http://php.net/manual/kr/keyword.parent.php
> > So it looks like proposing your syntax could lead to huge BC break.
> > In other languages (eg. Java) there is special syntax quite similar with
> >
super($a, $b) call.
> >
>
> super **is** Java’s parent
> keyword.
>
> There is definitely no breaking change here by enabling
> parent() as an
> alternative to parent::__construct() since it has no
> functionality at
> all right now. As a matter of fact, PHP currently aborts with a fatal
> error:
>
> ```
> Fatal error: Call to undefined function parent() in
> ```
>
> Reversing keywords in the global scope is done regularly in PHP minor
> versions, hence, that would not be a problem either.
>
> I see only one single problem, users might expect that parent()
> actually should call parent::__invoke(). However, that is not
> the case
> right now and nobody ever asked for it plus it is a little used feature
> anyways which does not require special treatment (imho).
>
>
There might be different parent scope calls not only to magic method but
also all base class methods.
> Regarding the fatal error on a missing constructor implementation in the
> parent. I fully agree that this should be possible.
>
> --
> Richard "Fleshgrinder" Fussenegger
>
--
regards / pozdrawiam,
--
Michał Brzuchalski
about.me/brzuchal
brzuchalski.com