On 23/09/2013 20:33, Nikita Popov wrote:

The main open question (or at least the focus of the discussion) seems to
be whether to allow multiple unpacks and trailing arguments.


I'm not sure I like the idea of multiple unpacks, were we to implement named parameters (if you did f(...(['a' => 2]), ...(['a' => 3])) you'd presumably have the $a argument overridden?), but I can't oppose it for linear arguments alone.

I'm not sure about trailing arguments either. I'm not sure if there's really a good use case for them.

I notice that we do not allow either in the variadics RFC, so I think it would make sense to be consistent with that. If someone really needs to do either of these, it would be a simple array_merge() away, and that might make the code clearer.

I also note that Python doesn't allow either of these. I can't find why exactly, but I would assume there were good reasons behind it.

So I think it would be best to allow neither of those, for the sake of consistency.

(OT: I've also just discovered that Python supports "a, b, *c = someseq" for multiple assignment, perhaps we could see "list($a, $b, ...$c) = $someseq" support?)

--
Andrea Faulds
http://ajf.me/

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

Reply via email to