I just caught myself doing the following :
(define (mouse-motion x y)
(let ((new-x (transform x))
(new-y (transform y)))
...))
(bind drawing "<Motion>" mouse-motion)
I don't understand how scheme allocates "local" variables. Is it a
c-like thing where it's pushed on the stack and then popped or is the
variable allocated and then when the routine returns the space must be
gc'ed.
Obviously if the space is being allocated then a procedure bound to
mouse motion could generate a _lot_ of allocation which would be very
inefficient.
Common sense says that local variables are implemented on the stack so
I'm OK and can continue to use let's in procedures which are being
used in event bindings.
If not, I suppose I would then have to declare variables in the
top-level env and use set! to change the values.
Please let me know.
Thanks
--
Brian Denheyer
briand_at_northwest.com
Received on Mon Oct 20 1997 - 03:57:38 CEST