On Mon, Sep 24, 2018 at 6:21 AM Andrey O Gromov <agro...@alfabank.ru> wrote: > > I want to do RFS proposal for new language concept - Class extension > functions. > Bring a little Javascript into PHP? Hrmm, maybe. I can see some value, though I'd offer a few thoughts:
1. Consider requiring that a class opt in to allowing these methods. e.g. `class DateTime implements MethodExtensions {}`. I know that this cuts out the power of this feature considerable, but it also limits the unexpected damage from that power. 2. Consider the impact on scoping. If a mixin can suddently access private properties in a foreign class, that may violate assumptions made by that class. Maybe treat mixins as having public scope to avoid this problem, that would also avoid much of my worries expressed in #1. 3. Pure bikeshed, I would make the syntax use the :: delimiter rather than ->. e.g. function DateTime::localTime() { ... } But that's my C++ hat speaking. -Sara -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php