On 6 September 2013 09:39, Nikita Popov <nikita....@gmail.com> wrote: > The RFC and implementation are not yet complete. I mainly want to have > feedback on the idea in general and on the Open Questions ( > https://wiki.php.net/rfc/named_params#open_questions) in particular.
Thanks for proposing this. I haven't looked at the patch yet, but I'm all for the feature. My thoughts on your open questions: Syntax: I suspect this will end up having to go to a vote (classic bikeshed), but I'm on the func('foo' => 'bar') train. :foo doesn't make sense in a PHP context (we'd have to implement that across the language, not just for function calls), : as a key-value separator would only work if it was also supported in array literals, and = feels a little wrong for this. I don't really like the unquoted parameter names so much; it's inconsistent with array literals and bare words as strings is something that's been discouraged for a long time. Variadics/splat: collecting both named and positional arguments into one array seems reasonable to me. I think the main use case there would be option parameters, which you'd have to validate anyway, so positional parameters would be dealt with at that point — I don't see separate arrays as conferring any great advantage in terms of validating parameters, and it's no simpler conceptually. call_user_func_array: for consistency, we might want to consider adding an analogue function that deals with named parameters, even though it would work via $callable(...$kwargs). Contracts: I agree with you, basically — it would have to be an E_STRICT or thereabouts, with the possibility of revisiting come a hypothetical PHP 6. Adam -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php