Groups | Search | Server Info | Login | Register
Groups > comp.lang.tcl > #55486
| From | Roderick <hruodr@gmail.com> |
|---|---|
| Newsgroups | comp.lang.tcl |
| Subject | variable ../.. global |
| Date | 2026-02-22 22:57 +0000 |
| Organization | MB-NET.NET for Open-News-Network e.V. |
| Message-ID | <81ab5038-2ab4-59ae-6058-561da5cf8e92@gmail.com> (permalink) |
The man page of variable is in some things not very explicit.
I have some questions.
Question 1:
What is the difference between:
namespace eval foo {variable bar 12345}
and
namespace eval foo {set bar 12345}
Do not create both namespace variable?
Is "variable" about allocating space for the variable if there is
no value in the declaration?
Question 2:
I read "If the variable command is executed inside a Tcl procedure,
it creates local variables linked to the corresponding namespace
variables"
Does it also create the namespace variable? Or I need also to
execute it outside the procedure?
Question 3
I want to source a script, perhaps inside a name space, perhaps not,
and I want instead of global, variables only visible in the name space.
Is the solution to change "global var" with "namespace var"?
Thanks for any hint!
Rod.
Back to comp.lang.tcl | Previous | Next — Next in thread | Find similar
variable ../.. global Roderick <hruodr@gmail.com> - 2026-02-22 22:57 +0000
Re: variable ../.. global Rich <rich@example.invalid> - 2026-02-22 23:25 +0000
Re: variable ../.. global Roderick <hruodr@gmail.com> - 2026-02-23 00:09 +0000
Re: variable ../.. global Rich <rich@example.invalid> - 2026-02-23 03:32 +0000
Re: variable ../.. global Roderick <hruodr@gmail.com> - 2026-02-23 09:08 +0000
Re: variable ../.. global Rich <rich@example.invalid> - 2026-02-23 19:41 +0000
Re: variable ../.. global Roderick <hruodr@gmail.com> - 2026-02-25 07:10 +0000
Re: variable ../.. global Rich <rich@example.invalid> - 2026-02-25 16:07 +0000
Re: variable ../.. global Schelte <nospam@wanadoo.nl> - 2026-02-23 09:51 +0100
Re: variable ../.. global Roderick <hruodr@gmail.com> - 2026-02-23 09:14 +0000
csiph-web