On 31 August 2013 03:21, Nikita Popov <nikita....@gmail.com> wrote: >> This is very special use case to be hidden in library functions, I don't >> think we need to have language syntax specially directed at that, at the >> cost of making it overall more complex and hard to understand. I can see >> what "add all those params at the end" syntax mean. However having >> something like ($a, ...$b, $c, ...$d, $e, $f, $g, ...$h) I have no idea >> what's going on at all and what is sent where.
I can grok this, but I'd rather not have to work through it when reading someone else's code. The likely code in current versions of PHP using call_user_func_array() would almost certainly be clearer here. So I think I'd prefer to disallow multiple splats in a function invocation too. <snip> > Of course, maybe my logic is flawed because I give too much credit to > programmers and assume that they will employ features when reasonable and > not when "hey, why don't I go put a ... in here!" At the risk of sounding even more bitter than normal, you need to spend more time in ##php with that attitude. ;) > Anyway, I don't think having a trailing fixed argument is *that* absurd. A > pretty pointless example off the top of my head would be > $this->query($query . ' LIMIT ?', ...$params, $limit), i.e. just adding > another bound param to a set of existing ones. > > I don't really insist on allowing the trailing normal args, because I don't > think they would be useful particularly often, but I just fail to see what > we gain by forbidding them. I have pretty much the same readability concern as with multiple splats — this example is clear, but I'm not sure it's so clear with a larger, more verbose set of arguments. This seems to require a slightly sharper eye to me (OK, it'd be better in a fixed width editor, admittedly): do_something($a_long_variable, $another_long_variable, ...$hey_a_splat, $something_else, $foo, $bar) I care less about this than multiple splats, but it's still a concern to me. Adam, who will send another e-mail momentarily to paint some bikesheds. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php