Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68780 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73977 invoked from network); 31 Aug 2013 17:49:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Aug 2013 17:49:55 -0000 Authentication-Results: pb1.pair.com header.from=adam@adamharvey.name; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=adam@adamharvey.name; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain adamharvey.name designates 209.85.223.178 as permitted sender) X-PHP-List-Original-Sender: adam@adamharvey.name X-Host-Fingerprint: 209.85.223.178 mail-ie0-f178.google.com Received: from [209.85.223.178] ([209.85.223.178:39787] helo=mail-ie0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9E/22-55332-1CC22225 for ; Sat, 31 Aug 2013 13:49:53 -0400 Received: by mail-ie0-f178.google.com with SMTP id f4so5768048iea.9 for ; Sat, 31 Aug 2013 10:49:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamharvey.name; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=PzmV0O01vD8VywKQJAZFdXG82MDK9B7oFEViJMSFRxw=; b=ArxMExhS+9sI1ySzKC6c3SE3uFst+89dfjSzPrQ60tLCMD6wjUw448MDByrUcAHBAP iG4Kw3fNxFo3N503rgX7SFuT1ac1la92Bouk9yB528ki2LlicpEnbMRyr+uEFTXH/p93 C2OldkPXVoC6KxUOByHjJpwswUiFH7UBdJ334= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=PzmV0O01vD8VywKQJAZFdXG82MDK9B7oFEViJMSFRxw=; b=g0zAsyyPIhrBOmEY0bQUtNsd5XLtb76encRHKYHU9Ta5j+JpRuQOM/4TLjHEElDgLC GVNuY4NNzQKcCRfX9isfAtnfVQqJCBoGEku2DdqyAJEe7Bg/CmJMJTminS3NK4d2mDV5 4StbRqY10EcXgWL790Xz1fko3jBuAB6Je6P00bKT4yTDHFwLJTpVA3SU0kQFGRbCMRS8 7NkxRscaM8cxS6D3UCOvzqJUPgdUC7TaWjBuhQnAh2Q+eNGItaUhKiy7qDDWd0E+yBUH tLCCqOO1D9yww2qGin8DrBVsPvVcZXQ91BklqhxTDtbpWk2r5TOcXd+wTVJhm2nduGxs j8mQ== X-Gm-Message-State: ALoCoQlQ3myPhSlwpUv17RDGgDbOJOgVSKDo3EDfCJ3xs7oWrkvod93jZ/efAIleN9Ixtq80bzCh X-Received: by 10.50.25.101 with SMTP id b5mr6667095igg.31.1377971389915; Sat, 31 Aug 2013 10:49:49 -0700 (PDT) MIME-Version: 1.0 Sender: adam@adamharvey.name Received: by 10.42.169.5 with HTTP; Sat, 31 Aug 2013 10:49:29 -0700 (PDT) In-Reply-To: References: <5220CEDE.8080600@sugarcrm.com> <5220DA50.9020306@sugarcrm.com> <522113B1.8000605@sugarcrm.com> Date: Sat, 31 Aug 2013 10:49:29 -0700 X-Google-Sender-Auth: mwHWHTvdGBlMo8DRKxpqCC35Y84 Message-ID: To: Nikita Popov Cc: Stas Malyshev , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Argument unpacking From: aharvey@php.net (Adam Harvey) On 31 August 2013 03:21, Nikita Popov 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. > 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 wha= t > we gain by forbidding them. I have pretty much the same readability concern as with multiple splats =E2=80=94 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.