binding script syntax

From: Ron Stanonik <stanonik_at_cogsci.ucsd.edu>
Date: Thu, 11 May 2000 10:23:15 -0700

Example:
(define (script |W|) (... uses |W| somewhere ...))
(canvas 'bind item event script)

Why must the bind script be a closure?
Why are the bind script substitutions single characters;
that is, why don't they require a %, like Tk?

We're trying to save the current state of a canvas.
We can get enough information about most items on the
canvas with the type, coords, and itemconfigure commands.

Saving event bindings is difficult, but some syntax changes
would help. If the script could be a list and if the
script substitutions required a %. For example,

(define (script path) (... uses path somewhere ...))
(canvas 'bind item event '(script %|W|))

Now (canvas 'bind item event) could return (script %|W|),
which simplifies saving the event binding.

Also, script could have arguments beyond the script substitutions.
For example,

(define (script path str) (format #t (~a ~a~%") path str))
(canvas 'bind item event '(script %|W| "hello"))

The % helps when parsing '(script ...) to recognize the script substituions.
Alternatively, the script substituions could remain single characters,
but then the parsing would become more complicated, to distinquish
the single character script substitutions from the rest of list.

I expect there were good reasons for the current syntax, unfortunately,
I haven't found a convenient way to search the stk mailing archives
for discussions related to those decisions.

Thanks,

Ron
stanonik_at_cogsci.ucsd.edu
Received on Thu May 11 2000 - 19:23:34 CEST

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