In what way does it not convey intent? or is a boolean operator and implies an expression. Using if as a statement modifier is altogether different than forcing the role of implied if on the or operator.
What? I don't understand what you're saying. The page you linked says
Binary "or" returns the logical disjunction of the two surrounding exp
+ressions. It's equivalent to || except for the very low precedence. T
+his makes it useful for control flow:
print FH $data or die "Can't write to FH: $!";
So I don't see how intent isn't conveyed, ... or ... is very common pattern, very familiar, seems like intent
Completely replacing a chunk of code in order to make a small change to it means that the replaced code didn't scale at all! The "It" in "It also scales better" was referencing if compared to unless. Using unless tends quickly to get into double negative land making it harder to think about complicated expressions and harder to maintain code using them.
Does it really matter what "It" you're refering? Ok, I'll give it a shot
die unless $live; ## the original line, which I expand a minute later
die unless $live or $reanimated; ## first change, and first error; mo
+ving on for now
die unless $live or $reanimated or !$cooked; ## second change double n
+egative, scary, still error, abandon unless, abandon unless, abandon
+unless
die if !$live or !$reanimated or $cooked; ## clarity, it works ... but
+ some people think differently, so choice,
die if !($live or $reanimated) or $cooked; ## whooops, error again, lo
+gic not practiced
die if !($live and $reanimated) or $cooked; ## works again, choice is
+choice
So yeah, I don't see any issue with how it "scale"
But I do see how having many things in unless gets confusing... if you cannot instantly write it correctly the first time
because I don't practice using unless this way, I don't think about it that way
but it didn't take a lot of practice to learn to use if, unless is the same way, just have to practice and learn
but yeah most people don't do that |