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

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

Thread Previous | Thread Next
From:
Sawyer X
Date:
June 21, 2016 14:21
Subject:
Re: [perl #127921] possible inconsistency in "perlop" documentationon precedence of || and //
Message ID:
57694D7E.4050307@gmail.com



On 06/20/2016 02:46 PM, Dave Mitchell wrote:
> On Mon, Apr 25, 2016 at 06:37:36PM +0200, Wolf-Dietrich Moeller (München) wrote:
>> 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.
> If no-one objects, I'll apply the following in a few days' time:
>
> -In the following sections, these operators are covered in precedence order.
> +In the following sections, these operators are covered in detail, in the
> +same order in which they appear in the table above.

+1.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About