NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Empty if clauses can serve to document (Score:1)
if (is_mungo_sorted @items) {
# The list is already in the order we need.
}
else {
# Need to sort them in bogological order.
@items = rearrange @items;
}
There's often a more elegant way to express things but an explicit do-nothing is sometimes the way I think about the problem, and it's good to have a way to comment that.
BTW, why doesn't the comment b
-- Ed Avis ed@membled.com
Re:Empty if clauses can serve to document (Score:1)
That's true. Shlomi Fish also expressed this point.
I personally try not to write things like that because I get irritated seeing an empty if(). It feels like there should be something there and I (or whoever wrote it) has forgotten or hasn't implemented it. So, to me it adds to the confusion but I can see how other people find it useful and expressive. Perhaps there should be a comment that says
# already ordered. do nothing.And yeah, I tried using h2, h3 and other stuff. These boxes don't get much...
Reply to This
Parent