A scripted dict is a deep dict that is scripted in a manner similar to a scripted list.
Because the structure of deep dict is well-defined, it can be scripted. That is, each value can be transformed in the same way that a word in a command is transformed.
package require {ycl dict deep} namespace import [yclprefix]::dict::deep set root /path/to/root set servers {one two three} set template { locations { tmp {{$root/var/tmp/$server}} pub {{$root/pub}} scripts {{$root/scripts}} } } foreach server $servers { set config $template deep scripted config lappend configuration $server $config } deep pretty configuration indent { } puts $configuration
output:
one { locations { tmp /path/to/root/var/tmp/one pub /path/to/root/pub scripts /path/to/root/scripts } } two { locations { tmp /path/to/root/var/tmp/two pub /path/to/root/pub scripts /path/to/root/scripts } } three { locations { tmp /path/to/root/var/tmp/three pub /path/to/root/pub scripts /path/to/root/scripts } }