in reply to Thoughts on using and, or, and not over && || !?
So, looking at the pro-high precedence arguments... What's the difference between using parenthesis for clarity and to address precedence issues with the high precedence operators vs. the low precedence ones? It seems like the answer to that is familiarity with the high precedence operators, the precedence for the high precedence operators, tradition, and of course older versions of Perl that do not have the low precedence operators.
Put differently, if the low precedence operators had existed from the beginning and the high precedence ones were added recently the low/high arguments would be reversed.So, back to my situation.
# BEGIN-SCRIPT-BLOCK # Script-Filter: # $vendor eq "Cisco" # and $sysdescr like /IOS/ # and $model like /2[89][05]/ # Script-Variables: # $tftp_server text "192.168.0.2" # $dest_name text # $source_name text # $MD5 text "Enter the MD5 hash for the source file here" # $reload_cmd text "reload at 00:00 reason New Firmware" # Script-Timeout: 300 # END-SCRIPT-BLOCK
So, going back to what I wrote at the top. The main argument against the low precedence operators appears to boil down to "tradition" and backwards compatibility. The examples where it can trip someone up can be dealt with by using parenthesis, right? For example, for tye's example:
$status = ( $foo->is_ready() and $foo->needs_munging() ) ? $foo->munge +() : $foo->status();
Assuming parenthesis can be used to deal with the precedence issues and I am hard pressed to see why they cannot, then I think the other factors in my situation favor using the low precedence operators because it will be more "consistent" across the two scripting languages, which will make life easier for my mostly non-programmer user base. I am not going to claim it's ideal, but my job is to help them do their job.
Elda Taluta; Sarks Sark; Ark Arks
My deviantART gallery
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Thoughts on using and, or, and not over && || !?
by haukex (Archbishop) on Jul 15, 2016 at 13:00 UTC | |
by eyepopslikeamosquito (Archbishop) on Jul 15, 2016 at 20:58 UTC | |
by tye (Sage) on Jul 16, 2016 at 00:27 UTC | |
by haukex (Archbishop) on Jul 18, 2016 at 08:33 UTC | |
by Argel (Prior) on Jul 15, 2016 at 15:47 UTC | |
by RonW (Parson) on Jul 15, 2016 at 23:36 UTC |