Re: [RFC][DISCUSSION] - Disallow Multiple Constructor Calls
| From: | Tim Bezhashvyly | Date: | Tue, 17 Jan 2017 20:51:20 +0000 |
| Subject: | Re: [RFC][DISCUSSION] - Disallow Multiple Constructor Calls | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-97830@lists.php.net to get a copy of this message | ||
Hi Nikita,
thank you for your feedback. Would you suggest to convert RFC into prohibition of explicit
__construct calls except parent::__construct?
Regards,
Tim
> On 17 Jan 2017, at 21:48, Nikita Popov <nikita.ppv@gmail.com> wrote:
>
> On Tue, Jan 17, 2017 at 9:17 PM, Tim Bezhashvyly <tim.bezhashvyly@gmail.com
> <mailto:tim.bezhashvyly@gmail.com>> wrote:
> Dear internals,
>
> me and Richard Fussenegger came up with a RFC draft disallowing multiple constructor calls -
> https://wiki.php.net/rfc/disallow-multiple-constructor-calls
> <https://wiki.php.net/rfc/disallow-multiple-constructor-calls>
> <https://wiki.php.net/rfc/disallow-multiple-constructor-calls
> <https://wiki.php.net/rfc/disallow-multiple-constructor-calls>>
>
> Here is a Reddit discussion thread -
> https://www.reddit.com/r/PHP/comments/5okdac/php_rfc_disallow_multiple_constructor_calls/
> <
>https://www.reddit.com/r/PHP/comments/5okdac/php_rfc_disallow_multiple_constructor_calls/>
> <https://www.reddit.com/r/PHP/comments/5okdac/php_rfc_disallow_multiple_constructor_calls/
> <https://www.reddit.com/r/PHP/comments/5okdac/php_rfc_disallow_multiple_constructor_calls/>>
>
> Any suggestions are highly welcome. Thank you.
>
> Regards,
> Tim
>
> Without putting a lot of though into this, the restriction sounds reasonable.
>
> However, it is not immediately clear to me how this can be implemented without adding a
> disproportionate amount of overhead for something which I would consider a rather minor feature. If
> an object only had a single constructor this would be a simple flag, but if you want to allow one
> call per each constructor in the hierarchy (i.e. you can call the constructor and each parent
> constructor once), this information needs to be stored somehow. The obvious way would be a hashset
> containing the constructors (or CEs) that have been called on the object, but I don't think
> this would be acceptable.
>
> Regards,
> Nikita