Subject: Re: portable finalizer
From: rpw3@rpw3.org (Rob Warnock)
Date: Thu, 05 Jul 2007 23:34:30 -0500
Newsgroups: comp.lang.lisp
Message-ID: <n8KdnZkGHojLWxDbnZ2dnUVZ_jidnZ2d@speakeasy.net>
Mark H. <mark.hoemmen@gmail.com> wrote:
+---------------
| On Jul 4, 1:40 am, Tamas Papp <tkp...@gmail.com> wrote:
| > (defmethod destroy ((object foo))
| >   (with-slots (pointer) object
| >     (when pointer
| >       (call_c_api_to_destroy pointer)
| >       (setf pointer nil))))
| 
| You might want to setf pointer to a null pointer instead of to NIL, so
| that the type of pointer is always a C pointer.  Not a big deal but it
| could be a useful invariant.
+---------------

Good point. In CMUCL, for example, NIL is certainly not a null pointer!
Nor is it a "C pointer" in the usual sense. [It has low-tag bits set.]


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607