Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: Goto-labels for exception handling?

by LanX (Saint)
on May 14, 2018 at 21:02 UTC ( [id://1214503]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Goto-labels for exception handling?
in thread Goto-labels for exception handling?

> The biggest problem with that being the dynamic scope. If the coder forgets this, the coder will discover the code's control flow jumping to unexpected places.

Exactly and thank you for getting to the point.

Contrary to die I can react to the case of a missing "receptor".

But what if this supposedly missing labeled was already used somewhere up the dynamic scope?

I think this could be solved... but I wanted to see if this wheel was already invented before.

Unfortunately does already the mention of "goto" cause a lot of unrelated emotions ... :/

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery

  • Comment on Re^4: Goto-labels for exception handling?

Replies are listed 'Best First'.
Re^5: Goto-labels for exception handling?
by RonW (Parson) on May 15, 2018 at 19:26 UTC

    Personally, when it helps readability and maintainability, I have used goto - just very very rarely. Usually, where goto might be used, last can be used, though sometimes requires also using an error variable.

    As for "missing receptors", the only idea I have come up with is to make sure that all "goto" labels are unique. A major problem doing this is finding all the labels. (Maybe Perl::Critic can help with this.) Pre- or post- fixing labels can reduce collisions, but this is very tedious extra work. Maybe defining Pluggable keywords, for example, throw and catch could automate this.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1214503]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (9)
As of 2024-04-19 08:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found