Ciao, to plot math function's graphs for my Guile interface to the GNU Scientific Library (GSL) I use a Guile interface to the Tool Command Language (TCL), Tk and a TCL extension called BLT. Tk handles the X Window GUI.
The superior Scheme thread spawns an inferior thread that holds a TCL interpreter; TCL commands are built as strings in the superior thread, handed to the inferior thread and TCL-evaluated. Plot widgets and coordinates vectors are TCL objects, and I use proxy GOOPS objects to manage them. The GOOPS things are protected by a guardian, and I use the AFTER-GC-HOOK mechanism to invoke appropriate destructors in the TCL interpreter when they are garbage collected. Fine. When writing a Guile-GSL script I code forms like this: (let* ((x ...) (y ...) (plot (blt-plot x y ...))) (sleep-or-ask-the-user-when-its-ok-to-go-on)) the GOOPS proxies are stored in the LET* environment, and this prevents the GC to collect them while the user is taking a look. The problem is that this solution is not so user friendly when one is interacting at the REPL. The need to store somewhere the GOOPS proxies demands more typing and mind handling of variable names: gsh> (define (x ...)) gsh> (define (y ...)) gsh> ; all right so far ; but the following is ugly (define p (blt-plot x y ...)) I thought to create "bag" objects in which plot proxies are automatically stored by BLT-PLOT, so the user does something like: gsh> (blt-plot-auto-collect #t) or: gsh> (blt-plot-auto-collect 'name-of-bag) and then I need a global collection of bags, so that one can do: gsh> (blt-plot-delete 'name-of-bag) or: gsh> (blt-plot-delete #t) No matter how I turn it, it seems to me that I am imposing to the user to remember annoying things. AFAIK, GNU Octave does not even try to do this: it just lets the user see one plot at a time. And Mathlab/Simulink(tm) just spawns GUI windows and lets the user destroy them by clicking on the X button. So, I wonder if someone has already found a solution for this. Suggestions are welcome. -- Marco Maggi "They say jump!, you say how high?" Rage Against the Machine - "Bullet in the Head" _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user