[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
- To: Tovar <TVR@ccrma-f4.stanford.edu>
- From: dmg@goldilocks.LCS.MIT.EDU
- Date: Fri, 26 Apr 91 13:51:17 EDT
- Cc: info-mcl@cambridge.apple.com
- In-reply-to: Your message of 26 Apr 91 01:17:00 -0700. <wI18u@CCRMA-F4.Stanford.Edu>
Actually, you're right about needing an UNWIND-PROTECT, but
you're example doesn't do it, because an abort may happen
between the binding of VAR and the unwind-protect.
(defmacro with-temp-bitmap ((var . limits) &body body)
`(let ((,var (make-bitmap ., limits)))
here--------->
(unwind-protect
(progn ., body)
(when ,var
(dispose-record (prog1 ,var (setq ,var nil)))))))
This is what you want:
(defmacro with-temp-bitmap ((var . limits) &body body)
`(let ((,var nil))
(unwind-protect
(progn
(setq ,var (make-bitmap ., limits))
. ,body)
(when ,var
(dispose-record ,var)))))
-dmg
(BTW, as a matter of style, the commas in a back-quoted lists
go with the expression they unquote, so:
(x . ,y) makes more sense than (x ., y)
Also,
o Use &REST instead of dotting your defmacro arglist
o Don't need to SETQ var after disposing of the record
since you have no further references to the variable
and at this point, you're not going to let the user
reference it anymore.