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 4347406
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:18:07+00:00 2026-05-21T12:18:07+00:00

So, I am testing somethings out, and have a test proc like so: proc

  • 0

So, I am testing somethings out, and have a “test” proc like so:

proc test {arg} {
    global state
    puts "Your arg is: $arg"
    set state 1
}
test somearg
vwait state

From reading about uplevel and upvar, is there a way that I can get away with not having to use global, and use either one of those options to set the state to “1” and then exit the program?

  • 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-05-21T12:18:08+00:00Added an answer on May 21, 2026 at 12:18 pm

    Yes, except that vwait always uses global variables for waiting on (strictly, it resolves variable names in the global scope; you can use other namespaces if you provide qualified names). What you can’t do is wait on a local variable (because events can’t see local variables outside their own call stack). Maybe this will change in the future, but certainly not now.

    In relation to the question about global, these statements are all the same in effect inside a procedure:

    global foo
    variable ::foo
    upvar #0 foo foo
    upvar ::foo foo
    namespace upvar :: foo foo
    

    You also have a bug in your code: you set the state before waiting for it to change. That won’t work anyway because you’ve got to wait first, and set the state from within some kind of event.

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

Sidebar

Related Questions

Unit testing is, roughly speaking, testing bits of your code in isolation with test
I want to write a small program that should print something like testing CPU...
Testing: return request.getCookies() == null; is not an appropriate way test. Is there another
For testing purposes I have to generate a file of a certain size (to
While testing a console app, I set the properties of the console window to
I am testing out the CustomUserNamePassword Validator for WCF and so far it only
We maintain a library used by test scripts which do system level testing. Part
I'd like to have a Python script read stdin from the shell (bash), and
I'm behind a firewall at work at the moment and I was testing something
Unit testing and ASP.NET web applications are an ambiguous point in my group. More

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.