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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:01:37+00:00 2026-05-23T13:01:37+00:00

I have two question about namespace in Tcl. namespace eval ::dai { set a

  • 0

I have two question about namespace in Tcl.

namespace eval ::dai {
         set a 5
         set b 10
         namespace export *
}

My questions are:

  1. export * – the export will make some variable inside this namespace can be used in other namespace, but what does this export * mean?

  2. Set a 5, should not we use variable a 5? are they the same? some tutorials say inside namespace, we should use variable, what is the difference between variable and set in namespace?

  • 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-23T13:01:37+00:00Added an answer on May 23, 2026 at 1:01 pm

    1) As is (supposed to be) logical for Unix users, “*” means “everything available at the moment”. It’s like when you do rm -f * in a shell, the shell expands “*” and replaces it with a list of all the files present in the current directory. Actually, as namespace manual states you can specify more elaborate patters than simple “*”. To learn what that “glob-style” thing mentioned there means read about string match.

    2) The question “should not we use…” is incorrect because it depends on what you want to do. If you want to declare a variable located in the namespace, use variable. If you want to set a variable, use set, but bevare that if that variable x is not exist in the namespace yet, Tcl will attempt to find a global variablte with this name, see:

    % set x 5
    5
    % namespace eval foo {
        set x 10
      }
    10
    % set x
    10
    # ^^ observe that the global variable has been assigned
    % namespace eval foo {
        variable x
        set x 20
      }
    20
    % set x
    10
    # ^^ observe that now `set x 20` found the variable `x` in the namespace and assigned to it
    

    This is explained in the “NAME RESOLUTION” section of the namespace man page.

    Note that this behaviour may appear illogical, but it actually matches that of the procedure scope: if you do set foo bar in a procedure body, this means setting the local variable unless you stated otherwise using either global or variable or by using a fully-qualified name (like ::ns::foo).

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

Sidebar

Related Questions

I have a quick question about namespace scope: I have two namespaces, A and
I have question about global variable in Objective-C. I have two .m files :
I have a two part question Best-Practice I have an algorithm that performs some
Ok so part two of I have no will power experiment is: Summary Question
I have a question about how to use Dispose() and destructors. Reading some articles
I have a question about random entries in Rails 3. I have two models:
I have a question about Database design. I have two tables, usertable and historytable,
I have two String.printable mysteries in the one question. First, in Python 2.6: >>>
I have two tables (well, two relevant for this question) : Bets (holds the
Actually, this question seems to have two parts: How to implement pattern matching? How

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.