Using closures as commands/button callbacks...

From: Josh Marantz <>
Date: Thu, 8 Jun 95 14:11:15 EDT

I've been messing about with the STk demos, and it seems to me that
the main reason to use Scheme as an extension language is to get to
attach closures to user events. This is exactly the architecture of
the GUI environment I built at my old company, Viewlogic, and I think
it works beautifully.

But when I started messing around with STk, I found that the actions
were quoted, like in emacs-lisp, which I think is wrong. I looked in
the code & saw that this comes from the fact that actions in Tk are
based on strings, and it's hard to turn a closure into a string and
deal properly with GC. However, if I were going to adopt STk for use
in my current work, that'd be the first thing I'd try to change.
Otherwise, why not just use Tcl? (Well...there's a few reasons,
but...without closures, I'm not sure they outweigh the huge momentum
of Tcl & the community behind it).

Does anyone have words of wisdom for using closures with user events
in STk?

Another thing I've thought of is wedding the Scheme inside STk to
Motif, whose Xt-based callbacks holda both procedure & data, which
should fit well with closures. But I guess that'd be a lot of work.


Received on Thu Jun 08 1995 - 20:28:40 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST