% interp create myslave
myslave
% interp eval myslave {set somevalue 12}
12
% myslave eval {expr {$somevalue + 2}}
14
% set somevalue
can't read "somevalue": no such variable
% interp create myslave
myslave
% proc mycommand {prefix text} {return "$prefix :: $text"}
% interp alias myslave slavecommand {} mycommand prefix1
slavecommand
% myslave alias othercommand mycommand prefix2
othercommand
% myslave eval {slavecommand "Some text"}
prefix1 :: Some text
% myslave eval {othercommand "Other text"}
prefix2 :: Other text
interp create myslave
set chan [open test.txt w]
interp transfer "" $chan myslave
myslave eval [list set chan $chan] ; # needed to set chan variable in slave
myslave eval {
puts $chan [join [lsort [info commands m*]] ,]
puts $chan "Commands starting with m in slave interpreter:"
}
interp transfer myslave $chan ""
puts $chan "Commands starting with m in main interpreter:"
puts $chan [join [lsort [info commands m*]] ,]
close $chan
% safe::interpCreate myslave
myslave
% myslave eval {expr {1+1}}
2
% myslave eval {package require http}
2.5.5
% myslave eval {source /script.tcl}
permission denied