RE: [PHP-DEV] Re: [RFC] Named parameters

2013-09-11 Thread jbo...@openmv.com
On Mon Sep 9 03:18 PM, Nikita Popov wrote: I created an RFC and preliminary implementation for named parameters: https://wiki.php.net/rfc/named_params Awesome work! Let only special functions accept named params - Proposal makes sense though there's still the challenge

[PHP-DEV] Re: [lists.php] RE: [PHP-DEV] Re: [RFC] Named parameters

2013-09-11 Thread ALeX
On Mon Sep 9 03:18 PM, Nikita Popov wrote: I created an RFC and preliminary implementation for named parameters: https://wiki.php.net/rfc/named_params I really like the idea! On Wed, Sep 11, 2013 at 2:16 PM, jbo...@openmv.com jbo...@openmv.com wrote: My preference would be to only

Re: [PHP-DEV] Re: [RFC] Named parameters

2013-09-11 Thread Andrea Faulds
On 11/09/2013 13:16, jbo...@openmv.com wrote: I'm still undecided about 'mixing' positional named arguments: An example use case for **kwargs here: http://www.python-requests.org/en/latest/api/ If you declare: request($method, $url, ...$args) Would $args collect 'method' and 'url' ?

Re: [PHP-DEV] Re: [RFC] Named parameters

2013-09-10 Thread George Bond
What about: class Giant { public function foo( $height, $width ) { ... } } class FallenOverGiant extends Giant { public function foo( $width, $height ) { ... } } There's nothing to stop you doing that; I think it's actually done in some of the codebases I work

Re: [PHP-DEV] Re: [RFC] Named parameters

2013-09-10 Thread Rasmus Lerdorf
On 09/10/2013 12:27 AM, Nikita Popov wrote: Yes, throwing an error during the signature validation is the right thing to do from a theoretic point of view. The issue is just that it breaks old code which didn't make sure that parameter names between parent and child lined up. Break is a bit

Re: [PHP-DEV] Re: [RFC] Named parameters

2013-09-10 Thread Daniel Macedo
On Tue, Sep 10, 2013 at 11:19 AM, Rasmus Lerdorf ras...@lerdorf.com wrote: I think you are over-thinking this case actually. I would prefer to just keep it simple. If someone does a named parameter call to a method that doesn't have a parameter with a specified parameter it is an error,

Re: [PHP-DEV] Re: [RFC] Named parameters

2013-09-09 Thread Daniel Macedo
Nikita, I agree with your views, although, I think your last suggestion comes close to being close to some sort of weird method overloading (the way I understood it). I'd expect B::foo() to throw a warning/error and maybe stop there, and you're considering reaching to the parent method to see if

Re: [PHP-DEV] Re: [RFC] Named parameters

2013-09-09 Thread Nikita Popov
On Mon, Sep 9, 2013 at 9:39 PM, Daniel Macedo admac...@gmail.com wrote: Nikita, I agree with your views, although, I think your last suggestion comes close to being close to some sort of weird method overloading (the way I understood it). Uh, I think this is a misunderstanding caused by my

Re: [PHP-DEV] Re: [RFC] Named parameters

2013-09-06 Thread Daniel Macedo
On Fri, Sep 6, 2013 at 6:01 PM, Pascal Chevrel pascal.chev...@free.fr wrote: Le 06/09/2013 18:39, Nikita Popov a écrit : Hi internals! I created an RFC and preliminary implementation for named parameters: https://wiki.php.net/rfc/named_params The RFC and implementation are not yet