From: "Brett H. Williams" Date: 2003-10-01T23:06:56+09:00 Subject: Re: tcltklib and not init'ing tk On Oct 1, Aamer Akhter wrote: > Hello, > > I'm using the tcltklib extension in ruby 1.8. It seems to be working > well for my transition from tcl. There are a couple of stumbling > blocks I'm running into: > > 1) is there a way to _not_ start tk? When I create a new interpreter > (let's say from a non X-fwded ssh session) it may cause a failure. I'm > only interested in Tcl. This is a big pain for me as well. I would really like to have this fixed, as Ruby/Tcl interaction is important to me. But it hasn't been a big enough pain to try and hack around in the C code :) (yet) > 2) Is there a japanese to english translation of > ext/tcltklib/MANUAL.euc? Or can somebody point to a tool that I may > use to do the translation? babelfish.altavista does not appear to > work. I've done all of my work without any kind of documentation in English. There just doesn't seem to be that strong an interest in mixing Ruby and Tcl (we are some of the exceptions). The tcltklib extension was written for Ruby/Tk. Access to the Tcl interpreter through it is a side effect--a highly useful side effect for me and you, but nevertheless not really what was intended by the developers. So using the Tcl interpreter from Ruby, and vice versa, is probably not even well documented in Japanese (someone please correct me if I am wrong). > 3). Are there any examples of ruby methods being called from the tcl > code running inside the interpreter? This is how I do it: set somevar [ruby "some_method()"] You can put any ruby code as the argument to the 'ruby' proc. You _must_, however, make sure that the return value of the ruby code is a string, or things will crash. You likely will have to do some creative things to get the scope that you want--Tcl can only communicate directly with class or global variables. This means if you call out to Tcl from Ruby, you will not have access to instance or local variables. It makes perfect sense, but typically requires doing some non-rubyish things to get access to what you need in Tcl. -- ---------------------------------------------- | -------------------------- Brett Williams | (970) 288-0475 Agilent Technologies | brett_williams@agilent.com ---------------------------------------------- | --------------------------