http://qs1969.pair.com?node_id=11127993


in reply to Re: Situation where warning "Found = in conditional, should be" seems obsolete (documentation)
in thread Situation where warning "Found = in conditional, should be" seems obsolete

Then maybe there should be the only one description?!

I mean that it is enough to describe one operator, and only get a link to it with explanation that difference is only precedence. This would become SPOT - single point of thuth.

I suggest to rename these two groups of operators.
1. They are EQUIVALENT except for their precedence, that means that they are both C-style or both not-C-style. Am I right?
2. The name of operators should differ in the way they differ from each other, so I suggest for example: 'Low-precedence-Logical-And' and 'High-precedence-Logical-And'.
3. As 'and' ('or') operates on so called "conditional" (on its left side) and also it returns the last evaluated expression (or so), I suggest further to rename it from 'Logical-And' to something else, if someone can find more suitable name. E.g. I would suggest 'Conditional-And' (therefore 'High/Low-precedence-Conditional-And'), how does it sound?

Also I suggest to make a link from documentation of operator 'and' to the documentation of statement 'if then' or vice versa. Why? For having SPOT. All the same behavior in one place, except for explanation of differences(?) (as I know they are not fully equivalent, because we can not use the return value of 'if' directly (e.g. we needs to envelope it with do{ })).

How do you think?

Upd.: Oh... I just realized that I made a suggestion (in 3rd point) the same as it is used in Java as you wrote earlier :( (Re^4: Situation where warning "Found = in conditional, should be" seems obsolete (documentation - C terminology)).
  • Comment on Re^2: Situation where warning "Found = in conditional, should be" seems obsolete (documentation)
  • Download Code

Replies are listed 'Best First'.
Re^3: Situation where warning "Found = in conditional, should be" seems obsolete (documentation)
by rsFalse (Chaplain) on Feb 09, 2021 at 00:55 UTC
    Also I want to suggest another thing in documentation, which is a bit related:
    Now in documentation there is a section 'Logical or and Exclusive Or' - https://perldoc.perl.org/perlop#Logical-or-and-Exclusive-Or. Both operators 'or' and 'xor' has the same precedence. But I think they differ from each other by significant: 1) one short-circuits, another - doesn't, 2) one - returns only 1 or ''/0, another returns last expression (in case of left expression it is returned evaluated). I suggest to split it into separate sections.
    As they were both in one section, I though of their similar behavior, and once I thought 'xor' will return last expression not 1 or ''/0 (related node: 'xor' operator is not a sibling to 'or' and 'and'?).
      PerlMonks is not the maintainer of the documentation. You can always open a documentation Pull Request in Perl's GitHub.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
        Thanks. I'll try to figure out how to do it one day. I usually write here for obtaining criticism or approval. And maybe someone who is more familiar with pulling requests and who speaks english better could ask for changes.

        Upd. Recently created a documentation issue -- https://github.com/Perl/perl5/issues/18572