I'll keep going offtopic a bit more. I would rather see named parameters implemented *prior* to this. Although maybe not instead, I think both might have their place.
On Wed, Apr 18, 2012 at 08:43, Yasuo Ohgaki <yohg...@ohgaki.net> wrote: > > Something like > > setcookie( name:'mycookie', value:'abc', secure:true, httponly:true ); > > is really nice to have. Source code will be much more readable. > I agree with this! But for short array syntax we kept the => as in $array = ["foo" => "bar"]; Not sure if this was a limitation, lack of that suggestion or a decision; but the shortest syntax it's still not... (as Yoda would say!) $array = ["foo": "bar"]; doesn't look weird to me, plenty readable, and that's the shortest! > This is getting off-topic, but while we're here, I think: > > setcookie($name => 'mycookie', $value => 'abc'); Not sure what the optimal PHP syntax should be for named parameters, but I think this isn't it. Back to the topic at hand. There doesn't need to be a lot of parameters on a function for this to be useful, even with IDE assistance. For a proper refactoring, where you'd only needing to change the function definition. In calls where the optional parameters would call a 'default', they should in fact be the default. Where as now we'd have to go through all the function calls for any case where we statically used the default and change it to the new default... But I couldn't support the comma train, for the insane «lots of parameters» case, would hate to read some fn($some,,,, $var,,, $other) call. I'd rather reuse a reserved word like 'default' (or even get a shorter one?) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php