Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:88044
Return-Path: <peter.e.lind@gmail.com>
Mailing-List: contact internals-help@lists.php.net; run by ezmlm
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 91560 invoked from network); 4 Sep 2015 06:57:42 -0000
Received: from unknown (HELO lists.php.net) (127.0.0.1)
  by localhost with SMTP; 4 Sep 2015 06:57:42 -0000
Authentication-Results: pb1.pair.com header.from=peter.e.lind@gmail.com; sender-id=pass
Authentication-Results: pb1.pair.com smtp.mail=peter.e.lind@gmail.com; spf=pass; sender-id=pass
Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.176 as permitted sender)
X-PHP-List-Original-Sender: peter.e.lind@gmail.com
X-Host-Fingerprint: 209.85.212.176 mail-wi0-f176.google.com  
Received: from [209.85.212.176] ([209.85.212.176:33663] helo=mail-wi0-f176.google.com)
	by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP
	id C8/C3-60419-3E049E55 for <internals@lists.php.net>; Fri, 04 Sep 2015 02:57:39 -0400
Received: by wiclk2 with SMTP id lk2so12086919wic.0
        for <internals@lists.php.net>; Thu, 03 Sep 2015 23:57:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :cc:content-type;
        bh=a+2/X+nfj26B4/dEYrdVG9gTiOFiyVBBBZd/fVKRzOI=;
        b=YsFZFzXrESx08hs5jVPLtijJO/PSJ/141WGVCI3BOp606MBVGVhOjjlw8pJ/QSh4i9
         RRqhxuiUfbXaki0SOoS1n+FKWZoMkdxrcZx0Z68pYQsGHJbkhFotP8NPCTJRRw/I75+T
         u0C2NOXN9ZlVr6aCKLrkMi7VDin8oudiZFBckxbngjr/q8mZjO20yPnUHpCrtfvl3TSz
         Wd7At4JM1YOovMHmnNQvhTEwgi3IRt6lVOKEX6Zbe/uQoCPQh6CD06aOBqYLTGT/LzWr
         HxDka3YkIt2PcFFc5D2+VRG8ylEAuGWfyLJCMHhAJXIgCQZvla2hjN9CyNCdwXa52DHv
         uATw==
X-Received: by 10.194.11.7 with SMTP id m7mr4251663wjb.56.1441349855862; Thu,
 03 Sep 2015 23:57:35 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.28.176.200 with HTTP; Thu, 3 Sep 2015 23:57:16 -0700 (PDT)
In-Reply-To: <CAB6YZuwimHWkh8ddvkagmXRQVCK-joUSmMYKKxxjx22BbktSRg@mail.gmail.com>
References: <BLU436-SMTP13020F8CE8795C628BDC665E26B0@phx.gbl>
 <CAESVnVq9kBhK_uEH2-HvQN4Wv8DVSnwc9ukRjrQ0KNjUbaAD7g@mail.gmail.com>
 <55E77CA9.7050609@gmail.com> <CAB6YZux4uYG7u0XRc_56MWFo+8G_h_VZZbWhCDVqA7hdu5XSpg@mail.gmail.com>
 <55E81959.6040305@gmail.com> <CAB6YZuwimHWkh8ddvkagmXRQVCK-joUSmMYKKxxjx22BbktSRg@mail.gmail.com>
Date: Fri, 4 Sep 2015 08:57:16 +0200
Message-ID: <CAEU6NAdfF0w383CNF46B8-Ly2Me+nzwpDFUvjeR4ZHk3x1MoUQ@mail.gmail.com>
To: =?UTF-8?Q?Pavel_Kou=C5=99il?= <pajousek@gmail.com>
Cc: Rowan Collins <rowan.collins@gmail.com>, PHP Internals <internals@lists.php.net>
Content-Type: multipart/alternative; boundary=047d7b5d259a27e5aa051ee66af9
Subject: Re: [PHP-DEV] [RFC] [Discussion] Short Closures
From: peter.e.lind@gmail.com (Peter Lind)

--047d7b5d259a27e5aa051ee66af9
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 4 September 2015 at 08:44, Pavel Kou=C5=99il <pajousek@gmail.com> wrote:

*snip*


> But even just #3 seems kinda "harder" to read than the form without
> any parenthesis.
>
> function partial($cb) { return ($left) ~> ($right) ~> $cb($left, $right);=
 }
>
> I know the parenthesis are optional in just one scenario, but I'd
> argue it's probably the most common one.
>

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.

That being the case, I would argue for consistency and simplicity. If you
need parentheses for other variants of this, require parentheses all the
way through. It will be simpler to learn and trip fewer people up.

Just think, if whoever constructed the if conditional hadnt thought "hey,
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 we
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.

Regards
Peter

--=20
<hype>
WWW: plphp.dk / plind.dk
CV: careers.stackoverflow.com/peterlind
LinkedIn: plind
Twitter: kafe15
</hype>

--047d7b5d259a27e5aa051ee66af9--