Ruby parens-free function calls [was Re: Accessing parent objects]

Python python at bladeshadow.org
Mon Mar 26 16:08:20 EDT 2018


On Mon, Mar 26, 2018 at 11:37:35AM -0700, Rick Johnson wrote:
> > Because of this "fix", the printed strings no longer match
> > the code being executed, but the strange, inconsistent
> > behaviour still occurs.
> 
> The supposed "inconsistent behavior" here has absolutely
> nothing to do with Ruby, no, it's all on _you_.

This is utter nonsense.  Ruby's parser allowed the
unintuitive/inconsistent behavior, so it has everything to do with
Ruby. 

The fact that the language allows you to write such expressions means
that SOMEONE WILL.  Your own messages seem to promote Ruby's
paren-less function calls as a good thing (which I vehemently disagree
with, but I can accept that's a matter of preference).  However, a
language that allows (a + b) to evaluate to a different value from
(a +b) (at the same execution point) is syntactically abysmal.

> Ruby followed the rules.
> But you didn't.

Nonsense... Your language's syntax parser is what defines the rules.
All of the expressions Stephen wrote did not yeild a syntax error,
therefore he "followed the rules."  

> No self-respecting professional programmer would ever write
> in such a manner. 

I think your expectation here is much too high.  I've seen A LOT of
Perl written by, for example, professional testers, of this ilk, and
I've seen it cause bugs when a) they got the syntax very slightly
wrong, or b) they got the syntax right but someone else to whom the
intention wasn't clear "fixed" it.

Humans are already good enough at making mistakes that they require no
additional encouragement, such as what is provided by allowing such
syntactical horrors.




More information about the Python-list mailing list