Thomas F. Burdick wrote:
On 2/5/06, Kenny Tilton ktilton@nyc.rr.com wrote:
This is one of my favorites ever:
To do dataflow from Tk, I settled on:
Translating for Peter, this means Kenny is trying to make changes to the Tk widgets (eg, a text box) show up as changes to c-input slots on the Lisp side. That way c-formulas can react to what the user typed.
trace add variable .w42 write "mytraceproc"
And mytraceproc cloned from sendata et al.
After a fascinating learning period I got it to work. Most of the time.
When it fails (get this) it is because the sympol is in a different package (My "LTk2" package.) That is the listener package while I am running. Normally callback gets symbols in LTk, and that is how they are stored in the callback hash table.
The internal interface to callbacks is: create-name, add-callback, remove-callback, and callback. Contrary to what the lambda-list of what the last three would make you believe, callbacks are named by strings, not symbols. You should get the name for a new callback from create-name. I'll be fixing that in subversion if Peter doesn't beat me to it.
Oh. Pity. Symbols are Good Things. I see no problem with symbols and wish. Why complicate things with unnecessary rules (Thou shalt use strings.)
Actually, I think LTk needs to evolve a little in regard to communication with wish. I understand the desire to make things easy for casual users, but I do not think that should extend to defining "an internal interface", with strictures on communication with wish.
I suggest refactoring to create a core that makes no assumptions about Tk output beginning with :callback/data/event, such that a power developer can work as they please. Then recreate the newby-friendly layer atop that. One trick might be to have the Dummies layer arrange for all dummy traffic to begin (:ltk-for-dummies ....) and if the engine gets a message that begins with something else it calls a generic function with the unexpected leading symbol as the first parameter. Then I can specialize EQL on :kennys-madness and control things while still being part of LTk.
Anticipating a possible alternative, the beauty of this is that one does not have to be forever tweaking LTk to make power users happy, one just stays out of their way by not bogarting the pipe to wish.
Overall, I think LTk is a great project for Common Lisp.
kt