[Fwd: Re: [cells-devel] CVS: Missing file variables.lisp ?!]
Ken Tilton
kentilton at gmail.com
Wed Dec 13 18:15:34 UTC 2006
Attila Lendvai wrote:
>> After someone asked on c.l.l I spent a day on making a defparameter a
>> Cell. The test worked but then I think I tried it live and it failed and
>> I decided I better get back to work on Algebra (but apparently never
>> took it out of my LPR).
>
>
> while making a clet in computed-class i've also played with the idea
> of a cell in a defparameter, but i couldn't come up with anything
> without symbol-macrolet. i think that can't be done transparently with
> standard common lisp constructs.
I just added variables.lisp to CVS just so folks can find it, and at the
same time modified cells.lpr /not/ to show it.
From there, the macro:
(defmacro def-c-variable (v-name cell &key ephemeral owning unchanged-if)
(declare (ignore unchanged-if))
(let ((c 'whathef)) ;;(gensym)))
`(progn
(eval-when (:compile-toplevel :load-toplevel)
(define-symbol-macro ,v-name (c-variable-accessor ',v-name))
(setf (md-slot-cell-type 'null ',v-name) (when ,ephemeral
:ephemeral))
(when ,owning
(setf (md-slot-owning 'null ',v-name) t)))
(eval-when (:load-toplevel)
(let ((,c ,cell))
(md-install-cell nil ',v-name ,c)
(awaken-cell ,c)))
',v-name)))
So this:
(def-c-variable *kenny* (c-in nil))
Expands to this:
(progn
(eval-when (:compile-toplevel :load-toplevel)
(define-symbol-macro *kenny* (c-variable-accessor '*kenny*))
(setf (md-slot-cell-type 'null '*kenny*) (when nil :ephemeral))
(when nil (setf (md-slot-owning 'null '*kenny*) t)))
(eval-when (:load-toplevel)
(let ((whathef (c-in nil)))
(md-install-cell nil '*kenny* whathef) (awaken-cell whathef)))
'*kenny*)
Obviously still experimental. :)
ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kentilton.vcf
Type: text/x-vcard
Size: 171 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/cells-devel/attachments/20061213/c82901d9/attachment.vcf>
More information about the cells-devel
mailing list