[Bese-devel] CPS-transforming symbol-macros

Maciek Pasternacki maciekp at japhy.fnord.org
Fri Aug 4 17:16:08 UTC 2006


Is there something wrong with CPS transformation of symbols that are
assigned macros, or is my design wrong?

I have something along this lines:

Global `variables' are defined this way (cut out from macroexpanding
my source; ~USERS-LIST~ is special variable - instance of a class
associated with persistent CL-STORE file):

,----
| (DEFINE-SYMBOL-MACRO *ANONYMOUS-USER* (CDR (ASSOC '*ANONYMOUS-USER* (VARIABLES-OF ~USERS-LIST~))))
| (SETF (DOCUMENTATION '*ANONYMOUS-USER* 'VARIABLE) "Anonymous access settings.")
`----

When I try to do (SETF *ANONYMOUS-USER* ...) inside (DEFACTION), it
simply doesn't work.  Alist entry in (VARIABLES-OF ~USERS-LIST~) stays
with old value.  What's funny is that (PUSH ... *ANONYMOUS-USER*) or
(SETF (GETHASH :FOO *ANONYMOUS-USER*) ...) does work, only direct
(SETF) on such pseudovariable seems to be simply ignored.

Now, I managed to work around this by defining wrapper, like this:

,----
| (defun %set-anonymous (value)
|   (setf *anonymous-user* value))
| (declaim (notinline %set-anonymous))
| 
| (defaction submit ((component anonymous-access-editor))
|   ; [...]
|   (%set-anonymous (when (value (enablep component))
|                     (make-instance 'user-profile ...)))
|   (answer nil))
`----

Now everything works.  Is it a bug in CPS, or am I wrong?

-- 
__    Maciek Pasternacki <maciekp at japhy.fnord.org> [ http://japhy.fnord.org/ ]
`| _   |_\  / { ...On the outskirts of nowhere, on the ringroad to somewhere,
,|{-}|}| }\/ on the verge of indecision, I always take the roundabout way,
\/   |____/ waiting on the rain... }                            ( Fish )  -><-



More information about the bese-devel mailing list