Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7753703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:07:09+00:00 2026-06-01T12:07:09+00:00

Is there an easy way to unroll the stack in Tcl? I have this

  • 0

Is there an easy way to unroll the stack in Tcl?
I have this strange problem where I have to get back to a particular stack frame, literally. I can get all the frame information using info command, but to actually get to a particular frame I will have to set some local variables in the each procedure and check them accordingly. I was wondering if there is an easier way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:07:11+00:00Added an answer on June 1, 2026 at 12:07 pm

    If you need to get code to do a non-local return (i.e., skipping back several levels) you can do this from 8.5 onwards with the -level option to return. See this example:

    proc foo-a {} {
        puts a-in
        foo-b
        puts a-out
    }
    proc foo-b {} {
        puts b-in
        foo-c
        puts b-out
    }
    proc foo-c {} {
        puts c-in
        foo-d
        puts c-out
    }
    proc foo-d {} {
        puts d-in
        bar
        puts d-out
    }
    proc bar {} {
        puts bar-in
        return -level 3
        puts bar-out
    }
    foo-a
    

    This works by throwing a special kind of exception; the details are quite hidden. Alternatively, you can also use try and throw if you’ve got 8.6 or a scripted implementation of them (see the Tcler’s Wiki for Tcl code that was used during the discussion of the code in 8.6).

    With older Tcl versions, the simplest mechanism is to use return -code 42 and to put some code in place up-stack to catch the custom exception and determine if it is the magic value (42 here; it’ll be the result of the catch) and respond appropriately. This can be quite effective, but is also messy. Which is why 8.5 onwards give you tools that are easier to use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an easy way to have this, so i don´t need to write
Is there any easy way to use grep functionality in NSIS scripts? I have
Is there an easy way to query a cluster for all vertices that have
Is there an easy way to get a report of all Python libraries installed
Is there easy way to iterate json structure like this ? var xstring =
Is there an easy way to iterate over an associative array of this structure
Is there an easy way to do this without a each loop. I want
Is there an easy way to get images of a smart phone/tablet with an
Is there an easy way how can I get in C char * from
Is there an easy way to log PHP errors to a log for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.