[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Why is with-rectangle-arg so complicated?
- To: firstname.lastname@example.org
- Subject: Why is with-rectangle-arg so complicated?
- From: email@example.com
- Date: Tue, 15 Oct 91 02:05:37 EDT
- Sender: firstname.lastname@example.org
I have been trying to write some efficient quickdraw code and have
tried using the trap level of coding rather than the functions defined
in QuickDraw.lisp. Perusing those functions, however, I am puzzled
why the often-used (with-rectangle-arg ...) form expands into an
invocation of (call-with-rectangle-arg ...) whose first argument is a
thunk encapsulating the computation. I would have assumed that
(with-rectangle-arg (r left top right bot)
(rlet ((r :rect :left left :top top :right right :bottom bot))
would do just as well. It seems as if the body would simply be
evaluated within the dynamic scope of r being a record on the stack,
and unless the body stored or returned r, all should be well. And
surely this would be more efficient when compiled than a call with a
thunk argument which is then funcalled!
Acting on my intuition, I tried writing my own version of
start-picture and get-picture using the above scheme, however, and
they just don't work. I assume I'm missing something either
fundamental or subtle. Could someone give me a hint? Thanks.
P.S. This is in 2.0 beta.