Syntactic Confectionery Delight | |
PerlMonks |
Re^4: Number of times I've used goto in Perl (early return)by tye (Sage) |
on Mar 26, 2015 at 01:32 UTC ( [id://1121353]=note: print w/replies, xml ) | Need Help?? |
Yeah, I saw several things in that node. There was the topic of this thread (goto), the intro paragraph that said that this can conflict with 2 other things, and a prominent code comment suggesting that a label could be inserted if goto were used. And none of that seems to have anything to do (as far as I could figure out) with the alternating-&&= part of the code that you commented on. I agree that the &&= part of the code is interesting. I also fail to see where a goto would help any of the code shown. So I was only addressing the topic that matched the thread, the opening paragraph, and the prominent comment in the code. Perhaps it was actually desirable for the &&= short-circuiting to apply to all of the code so the better alternative was a lot of "goto failed if ! ...;" lines? That's my best guess, anyway. For such a case, the better approach I would do would be to change:
to:
Sometimes "throw exception" is an even better solution than "early return", of course. - tye
In Section
Past Polls
|
|