Groups | Search | Server Info | Login | Register


Groups > comp.lang.tcl > #55506

Re: variable ../.. global

From Rich <rich@example.invalid>
Newsgroups comp.lang.tcl
Subject Re: variable ../.. global
Date 2026-02-25 16:07 +0000
Organization A noiseless patient Spider
Message-ID <10nn6nm$t75v$1@dont-email.me> (permalink)
References (2 earlier) <50978edb-fbd0-2c16-cacb-e5c7557bc279@gmail.com> <10nghou$2lbjj$1@dont-email.me> <90732c48-bc1c-ddab-7c22-c6ac877b664f@gmail.com> <10niage$394up$1@dont-email.me> <f8a23111-2ac1-b4e3-2252-6cf7631faa06@gmail.com>

Show all headers | View raw


Roderick <hruodr@gmail.com> wrote:
> 
> On Mon, 23 Feb 2026, Rich wrote:
> 
>> Continue with a test of a non-existant namespace:
>>
>>    % namespace eval nn2 {proc pp2 {} {global ::nn3::v; set v 1}}
>>    % set nn3::v
>>    can't read "nn3::v": no such variable
>>    % nn2::pp2
>>    can't access "::nn3::v": parent namespace doesn't exist
> 
> 
> # tclsh
> % global ::nn3::v
> % % set ::nn3::v 1
> invalid command name "%"
> % variable ::nn3::v
> can't define "::nn3::v": parent namespace doesn't exis
> 
> I think, that is a difference between global and variable.
> The last do allocate memory, the first only signalizes that
> a local var in procedure is bound to other var that perhaps
> does not exist yet.

Small syntax error on line 3:

  $ rlwrap tclsh 
  % global ::nn3::v
  % set ::nn3::v 1
  can't set "::nn3::v": parent namespace doesn't exist
  % variable ::nn3::v
  can't define "::nn3::v": parent namespace doesn't exist
  % 

Back to comp.lang.tcl | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

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