develooper Front page | perl.perl5.porters | Postings from April 2016

RE: [perl #127921] possible inconsistency in "perlop" documentationon precedence of || and //

Thread Previous | Thread Next
April 25, 2016 16:37
RE: [perl #127921] possible inconsistency in "perlop" documentationon precedence of || and //
Message ID:
Smylers writes:

> However, in-between those two parts you quoted there is also:

>  Perl operators have the following associativity and precedence, listed
>  from highest precedence to lowest.
> followed by a table, which includes these lines:
>      nonassoc    == != <=> eq ne cmp ~~
>      ⋮
>      left        || //
>That clearly asserts that it specifies precedence levels, and shows that
>|| and // (and == and ~~) are of equivalent precedence.
> The precedence is specified, correctly, in the table you skipped over.
> The sentence “In the following sections, these operators are covered in
> precedence order” is a description about the documentation that follows,
> not about precedence in Perl — it's informing readers how to navigate
> the subsequent sections, given the precedence order that's already been
> defined above it.

These two sentences you cite are quite similar wrt expression and grammar, but you write that these sentence should *not* be interpreted in the same way. You say that the first sentence *specifies* an ordering line by line. But why is the second sentence to be interpreted in a more fuzzy way, while it has similar wording and grammar?
For me these similar sentences indicate that either both operator list and sections below or none of them are exactly ordered. I cannot follow you to see the difference you describe from the wording of the sentences.

So either these two sentences should be clarified, or both operator list and sections below should obey the *same* ordering rules.

BTW, Smylers also writes:
> If somebody wants a definition of eq or ||, they can currently be sure
> they've read all their is to know about it in a relatively short
> section. 
This is not true as the section on || is not complete. While the first paragraph of the section on // is in fact about //, the following paragraphs in the section on // are about the three operators &&, || and //. Thus people looking for || (or &&) will even miss these helpful explanations, if they only read the sections on || or &&.
In addition, this could even lead to the (wrong) impression, that all three operators have the same precedence, as they are covered together in this section.
Maybe it would be worthwhile to do an overhaul to that part also (it seems to me that the section on // was added to the doc at a later stage, and unfortunately not really consistent).

Taking this together, it may be best to delete the reference to "precedence order" for the sections, and change the sentence below the operator list to something like "In the following sections, these operators are covered *in detail*." This would avoid wrong conclusions about precedence derived from the section list.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About