[Bese-devel] :template options referring to data within the "current" component

marco mb at bese.it
Mon Oct 4 17:15:48 UTC 2004


Anthony Juckel <ajuckel at gmail.com> writes:

> Is there a way to refer to the current component when supplying
> :template options?

there's a better way to do this. i'm going to remove the :template
option from the defcomponent macro and replace it with:

(defclass template-component (standard-component)
  ((template-name :accessor template-component.template-name
                  :initarg :template-name
                  :allocation :class)))

(defgeneric template-environment (template-component))

(defmethod template-environment ((component template-component))
  (make-tal-environement 'component component))

changing the template name is a simple matter of defining a new method
on the function template-component.template-name. this has a few of
added benefits:

1) extending a super class' environment is easy.

2) anthony has a clane way to decide the template name based on the
   context or the response or the component or whatever.

3) less vodoo majick macros (there is a point where macros become
   opaque, defcomponent is close to, if not beyond, that point).

i have only one doubt, the default implementation of
template-component.template-name will simply access the template-name
slot in the component, should the allocation of this slot be :class or
:instance?

this work (along with other big component api changes) will happen on the
ucw--component-mop--dev--0.3 branch.

-- 
-Marco
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
     -Leonard Cohen




More information about the bese-devel mailing list