Artifacts Associated With Ticket 63806646d2436e67
Ticket change [b903551bca] (rid 233285) by jal_frezie on 2024-09-09 15:47:05:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- comment initialized to:
If an array exists in the base namespace, then you add elements to it in a child namespace, they are added to the base namespace version only. Trying to read the array in the child namespace reads the base namespace version. On the other hand if you create the array in the child namespace, then add elements to it in the base namespace, the two arrays remain distinct and each reads correctly in its own namespace. Example: $ tclsh % info patchlevel 8.6.14 % array set foo {qaz 1 wsx 2 edc 3 rfv 4} % namespace eval bar {array set foo {tgb 5 yhn 6 ujm 7}} % array get foo ujm 7 edc 3 qaz 1 tgb 5 rfv 4 wsx 2 yhn 6 % namespace eval bar {array get foo} ujm 7 edc 3 qaz 1 tgb 5 rfv 4 wsx 2 yhn 6 % array get bar::foo % % namespace eval bar {array set xyzzy {tgb 5 yhn 6 ujm 7}} % array get xyzzy % namespace eval bar {array get xyzzy} ujm 7 tgb 5 yhn 6 % array set xyzzy {qaz 1 wsx 2 edc 3 rfv 4} % array get xyzzy edc 3 qaz 1 rfv 4 wsx 2 % namespace eval bar {array get xyzzy} ujm 7 tgb 5 yhn 6 % array get bar::xyzzy ujm 7 tgb 5 yhn 6 % - foundin initialized to: "8.6.14"
- is_private initialized to: "0"
- login: "jal_frezie"
- priority initialized to: "5 Medium"
- private_contact initialized to: "21e680c66afc6863cbbaf0aa5b26c9e8a4429339"
- resolution initialized to: "None"
- severity initialized to: "Severe"
- status initialized to: "Open"
- submitter initialized to: "jal_frezie"
- subsystem initialized to: "21. [namespace]"
- title initialized to:
Cannot create array in namespace if it already exists in base
- type initialized to: "Bug"
Ticket change [16f850fb3a] (rid 233298) by oehhar on 2024-09-10 06:38:31:
- closedate changed to: "2460563.77675515"
- closer changed to: "oehhar"
- icomment:
Yes, this is a known design choice in TCL 8.6, that global variables are seen in any namespace. This was changed in TCL 9. Best see the migration document for an explanation. And yes, it is weired and full of potential side effects... THank you, Harald
- login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Invalid"
- status changed to: "Closed"
- username: "oehhar"