On 4 September 2015 at 08:44, Pavel Kouřil <pajou...@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

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

Reply via email to