Let's say I don't know the name of the dict I have to pass, but I have list for it, so the setup looks like :
set mylist "dict_a dict_b"
dict set dict_a a 1
dict set dict_a b 2
dict set dict_b c 3
dict set dict_b d 4
But now I want to pass all my dict to a procedure (I still don't know the name of the dict, I know only the list of name). I would do something like :
proc test_dict {mylist} {
foreach element $mylist {
upvar 1 [subst $element] $element
}
foreach dict_ $mylist {
puts " test of existence : [dict exists $dict_ a]"
}
}
The answer of tcl is :
test of existence : 0
test of existence : 0
When called with :
test_dict $mylist
I should get 1 and 0 but not this. What is wrong in my proc ?