From: matz@... (Yukihiro Matsumoto) Date: 2002-08-15T23:53:23+09:00 Subject: Re: ruby/tk internals...? Hi, In message "Re: ruby/tk internals...?" on 02/08/15, Ferenc Engard writes: |> The argument string is evaluated under the context created for each |> invocation of "ruby" command. | |And what is this context? Is it a plain new Object for every invocation, |i.e. I can use only global variables and methods defined in main, cannot |define new methods or classes, etc.? It is a plain new "scope" for every invocation. You can define new methods or classes, but I do recommend you to keep the argument to the "ruby" command small. |How does it work with GTK? The context is saved in the Proc object. It is same for Ruby/Tk, for example, require "tk" TkButton.new(nil, 'text' => 'hello', 'command' => proc{print "hello\n"}).pack('fill'=>'x') TkButton.new(nil, 'text' => 'quit', 'command' => 'exit').pack('fill'=>'x') The callback (print "hello\n") is executed under the current context. "ruby" command is used to trigger the callback. matz.