Re: binding script syntax

From: Ron Stanonik <stanonik_at_cogsci.ucsd.edu>
Date: Fri, 12 May 2000 05:21:29 -0700

    IMHO, one big advantage of using a closure over a list literal
    is that you can close variables. I use this type of syntax
    extensively:
    
     (define (bind-it foo)
       (canvas 'bind item event
               (lambda (|W|) ( ... uses foo somewhere ... )))
       (canvas 'bind item anotherevent
               (lambda (|W|) ( ... uses foo somewhere ... )))
       )
    
    where you can refer to the local binding `foo' inside the bound
    script. If you use a literal list, there's no easy way to do it.
    
Yes, we had to rewrite closures to use backquote/comma.

(define (script path foo) (... uses foo somewhere ...))
(define (bind-it foo)
   (canvas 'bind item event `(script ,|W| ,foo))
   (canvas 'bind item anotherevent `(script ,|W| ,foo))

Thanks,
Ron
stanonik_at_cogsci.ucsd.edu
Received on Fri May 12 2000 - 14:23:21 CEST

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