[Bese-devel] EVAL: variable SELF has no value
Pascal J.Bourguignon
pjb at informatimago.com
Tue May 17 03:42:16 UTC 2005
I've got a simple render-on method that just calls another component:
(defmethod render-on ((res response) (compo user-admin))
(call 'not-implemented-yet
:message (_ "Administration des utilisateurs")))
(defcomponent not-implemented-yet (widget-component)
((message :accessor not-implemented-yet.message
:initform nil
:initarg :message
:documentation "A message which will be presented to the user"))
(:default-initargs
:title (_ "Pas encore implémenté" "Window Title")
:stylesheet "stylesheet.css")
(:metaclass standard-component-class)
(:documentation "Not implemented yet."))
(defmethod render-on ((res response) (compo not-implemented-yet))
(<:div
:id "not-implemented-yet"
(when (not-implemented-yet.message compo)
(<:h2 (<:as-html (not-implemented-yet.message compo))))
(<:p (<:as-html
(_ "Désolé, cette fonction n'est pas encore implémentée.")))
(<ucw:form
(button (_ "Retour" "Button") (answer-component compo nil)))))
Then, when the first component is to be rendered, I obtain instead a
backtrace with the top of stack being:
EVAL frame for form ((LAMBDA (RES COMPO)
(DECLARE (SYSTEM::SOURCE
((RES COMPO)
(DECLARE (IGNORABLE RES COMPO))
(BLOCK RENDER-ON
(CALL 'NOT-IMPLEMENTED-YET
:MESSAGE
(_ "Administration des utilisateurs"))))))
(DECLARE (IGNORABLE RES COMPO))
(CALL-COMPONENT SELF (MAKE-INSTANCE 'NOT-IMPLEMENTED-YET
:MESSAGE "Administration des utilisateurs")))
#:G13176 #:G13177)
By the same token, I cannot write (ANSWER result) because this macro
expands to an expression refering SELF, so I have to write:
(ANSWER-COMPONENT compo result)
Do I do something wrong or should I just avoid these macros?
--
__Pascal Bourguignon__ http://www.informatimago.com/
Until real software engineering is developed, the next best practice
is to develop with a dynamic system that has extreme late binding in
all aspects. The first system to really do this in an important way
is Lisp. -- Alan Kay
More information about the bese-devel
mailing list