Hello,
In tcltk.rb (v. 1.6.7) the definition of the tcl “ruby_fmt” proc is
defective. Here is the original implementation
(TclTkInterpreter::initialize(), line 95):
···
if $DEBUG
@ip._eval("proc ruby_fmt {fmt args} { puts \"ruby_fmt: $fmt
$args" ; ruby [format $fmt $args] }")
else
@ip._eval(“proc ruby_fmt {fmt args} { ruby [format $fmt $args] }”)
end
The problem is that anything using ruby_fmt (e.g. it is hard-wired in
callback-handling code) do not run in global scope, instead they run in
this proc’s (temporary) scope. Because of this, I cannot use even
TclTkVariables in callbacks. The correct implementation IMO should be
executing the command in the scope of the calling proc (thus, ruby and
ruby_fmt will be really interchangeable):
if $DEBUG
@ip._eval("proc ruby_fmt {fmt args} { puts \"ruby_fmt: $fmt
$args" ; set cmd [list ruby [format $fmt $args]] ; uplevel $cmd }")
else
@ip._eval(“proc ruby_fmt {fmt args} { set cmd [list ruby [format
$fmt $args]] ; uplevel $cmd }”)
end
Circum