Re: [PHP-DEV] Mixed mode methods

2019-09-03 Thread Larry Garfield
On Mon, Sep 2, 2019, at 1:03 PM, Andreas Hennings wrote: > The value of parameter-based polymorphism is for cases where the > calling code wants to handle all parameter types in one call, whereas > the callee has different implementations for different parameter > types. > > This is not the case

Re: [PHP-DEV] Mixed mode methods

2019-09-02 Thread Andreas Hennings
In my experience, things that have different roles or behavior should be differently named. I have seen a lot of functions with dynamic return types based on a mode set in the parameter (e.g. the return type could be string, string[] or string[][] depending on whether some parameter is NULL or not

Re: [PHP-DEV] Mixed mode methods

2019-09-02 Thread Christian Schneider
Am 02.09.2019 um 17:01 schrieb Dan Ackroyd : > Also(, without checking to see if it's feasible,) to me a less > surprising approach would be to allow static and instance methods to > be declared separately with the same method name. > > class Foo { >static function loadXml() { >echo "I

Re: [PHP-DEV] Mixed mode methods

2019-09-02 Thread Dan Ackroyd
On Mon, 2 Sep 2019 at 15:03, Christian Schneider wrote: > > Please don't shoot this down just because you are not the target audience of > such a feature That is always good advice. When you draft the RFC, I strongly recommend coming up with a line of reasoning of why creating static versions o

Re: [PHP-DEV] Mixed mode methods

2019-09-02 Thread Nikita Popov
On Mon, Sep 2, 2019 at 4:03 PM Christian Schneider wrote: > Hi internals, > > While some people are trying to make PHP a stricter language I'm also > interested in making it a more flexible language by allowing to opt-in to > advanced features for people who want it. > Please don't shoot this dow