On 13.04.2010, at 23:39, GM wrote:

> Personally, I would strongly prefer the caller syntax my_func('a', 'b', 'c' 
> => 'd', $e => $f) just to because
> 
>       1) it's consistent with array declaration syntax
>       2) it allows arbitrary names for parameters, which will become the 
> array keys  ... and can include funny characters
>       3) naked identifiers in PHP are used only for functions, classes and 
> constants, so c => 'd' looks like a constant
>       4) it allows the flexibility of dynamically specifying parameter names, 
> although this will probably be rarely needed
> 
> My second favorite is my_func('a', 'b', c => 'd') ... which I consider worse 
> but at least not as bad as my_func('a', 'b', c: 'd') ... which seems to come 
> out of left field as it's not consistent with the rest of PHP syntax. Unless, 
> of course, c: 'd' is going to be a shorthand for 'c' => 'd' ... which makes 
> me ask ... if you guys are ever going to make a short array declaration 
> syntax, will it look something like this:    {'a'=>'b', 'c'=>'d'} or will it 
> look like {a: 'b', c: 'd'} ?


Just stumbled over a post about SQL 2011 which also seems to get support for 
named parameters for functions [1]:
"Named arguments in function calls. PostgreSQL 9.0 supports that, but using the 
syntax foo(3 AS a) instead of what ended up in the standard, foo(a => 3)."

regards,
Lukas Kahwe Smith
m...@pooteeweet.org

[1] http://petereisentraut.blogspot.com/2010/04/news-from-sql-standard.html


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to