Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88047 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 493 invoked from network); 4 Sep 2015 08:10:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Sep 2015 08:10:54 -0000 Authentication-Results: pb1.pair.com header.from=mailto.woden@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=mailto.woden@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.217.172 as permitted sender) X-PHP-List-Original-Sender: mailto.woden@gmail.com X-Host-Fingerprint: 209.85.217.172 mail-lb0-f172.google.com Received: from [209.85.217.172] ([209.85.217.172:36230] helo=mail-lb0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B8/20-33222-D0259E55 for ; Fri, 04 Sep 2015 04:10:53 -0400 Received: by lbcao8 with SMTP id ao8so6961447lbc.3 for ; Fri, 04 Sep 2015 01:10:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=mv/E/ez+iKFyY2Fw1QBl7OWtaMzv/1Utg09if5/17Gs=; b=nOZUNDIEWcY4JzSQvT368pziYs7Ete+1Hg1ZYiTIc6WKIw54063onZb0gjCFgdNLzB IAowGiMi7i6FzeT3wslKLcPrvTrdP+9MgAOzB0TbHdQYFXdhYcyHdcHGn2za6DIy+M2t 7qBHX7RSNjfreeG64Zywo2753q1TCDXR4x8oTsUSaHu2PlxHlJlTgHMJ2kBW2pR5J7M+ Twh3IT/juGlB/wr7T1S3+sHlMqmlX/fGeyNcIAg2EJwK2DrIJSz81hvwH9qnbBwaymQS kAwwi3Cyzy+d35Q10MS4BpNxOn94nJQD20anvDAxd/26H814Zfj8DQlQgPO9lxCYqXgQ uqYg== MIME-Version: 1.0 X-Received: by 10.112.160.98 with SMTP id xj2mr2482831lbb.124.1441354249348; Fri, 04 Sep 2015 01:10:49 -0700 (PDT) Received: by 10.114.78.231 with HTTP; Fri, 4 Sep 2015 01:10:49 -0700 (PDT) In-Reply-To: References: <55E77CA9.7050609@gmail.com> <55E81959.6040305@gmail.com> Date: Fri, 4 Sep 2015 10:10:49 +0200 Message-ID: To: =?UTF-8?Q?Pavel_Kou=C5=99il?= Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a11c3421c07316d051ee7702b Subject: Re: [PHP-DEV] [RFC] [Discussion] Short Closures From: mailto.woden@gmail.com (Daniel Persson) --001a11c3421c07316d051ee7702b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > Depends how you define simplicity. Because $a ~> $b ~> $c ~> $d is > IMHO more simple than ($a) ~> ((($b) ~> (($c) ~> $d($foo))) - which is > a result of the combination of amendments #2 and #3. I honestly do not > know if I wrote the parenthesis right now or not (probably not), > because there's simply just too many of them. Might be a good place to suggest refactoring? Removing a semantics because when you try to write too dense code it's hard to read. The same goes with an one line if assignments. $a =3D ( [some really big expression] ) ? $b : $c; Could be really hard to read but then you look into refactoring that code. Might be my inexperience with closures but when do you chain 3 of them? Best regards Daniel On Fri, Sep 4, 2015 at 9:43 AM, Pavel Kou=C5=99il wrot= e: > On Fri, Sep 4, 2015 at 8:57 AM, Peter Lind wrote= : > > On 4 September 2015 at 08:44, Pavel Kou=C5=99il wr= ote: > > > > You're arguing that, subjectively, to you - parentheses make things > harder > > to read. For others they clarify things. > > It should be obvious to everyone that this particular path of the > discussion > > has about as much merit as tabs vs spaces. > > Sure, it is subjective - but what isn't? > > > That being the case, I would argue for consistency and simplicity. If y= ou > > need parentheses for other variants of this, require parentheses all th= e > way > > through. It will be simpler to learn and trip fewer people up. > > Depends how you define simplicity. Because $a ~> $b ~> $c ~> $d is > IMHO more simple than ($a) ~> ((($b) ~> (($c) ~> $d($foo))) - which is > a result of the combination of amendments #2 and #3. I honestly do not > know if I wrote the parenthesis right now or not (probably not), > because there's simply just too many of them. > > Sure, parenthesis can help people understand things, but I'd say that > at the same time, too many of them can be a problem as well (as the > fun name for LISP - "lost in stupid parenthesis" - suggests). > > > Just think, if whoever constructed the if conditional hadnt thought "he= y, > > let's be clever and save some keystrokes by making the curlies optional > in > > some cases" we wouldn't have the multitude of bugs and security holes w= e > > know to exist, we wouldn't have to warn the young'uns against improper > use > > of if, we wouldn't have to write codesniffer rules against single line > ifs, > > etc, etc. > > > > Any argument to the effect of "let's be clever" or "it'll save some > > keystrokes" is void. Period. > > This is not about saving characters, it's about not overcomplicating > things. > > > > > Regards > > Peter > > > > Regards > PK > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a11c3421c07316d051ee7702b--