On Tue, Jan 17, 2017 at 9:17 PM, Tim Bezhashvyly <tim.bezhashv...@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> > > 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/> > > 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