[Bese-devel] Re: Proposal (was: [Lispweb] [ANN] UnCommon Web 0.2 - learning to walk)

Marco Baringer mb at bese.it
Tue Mar 2 19:38:52 UTC 2004


On Martedì, mar 2, 2004, at 19:34 Europe/Rome, rm at fabula.de wrote:

> Well, i just got tired ouf having to build a deeply nested plist
> that mirrors the objects i want to render -- the code has to walk
> the object structure to create the plist which is then walked by the
> tal function.

i get tired of that too. i guess we need a better way to create 
enviroments, for starts slots-to-tal-enviroment should probably be 
moved from ucw to yaclml.

> Ah, i see. So your code does in fact modify the environment.

otherwise there is no way from within a dolist to access the "outer" 
bindings.

> I guess i would imagine a stack based environment object with a generic
> 'fetch-value (name)'. A lookup would would apply this method to all
> objects on the stack until successfull.

Come to think of it this would also allow us to use different binding 
mechanisms (hash tables if there are lots of bindings; directly use 
objects instead of converting the slots to a list; etc.) based on the 
specs.

We could do this with:

(defgeneric lookup-tal-variable (name enviroment)
   (:documentation "Return the value assciated with NAME in the
   enviroment ENVIROMENT."))

(defgeneric fetch-value (name binding)
   (:documentation "Return the value associated with NAME in the
   binding set BINDING."))

(defgeneric push-binding (binding enviroment)
   (:documentation "Create a new enviroment with all the bindings
   in BINDING. Any bindings in BINDING must shadow (on successive
   calls to LOOKUP-TAL-VARIABLE) other bindings currently present
   in ENVIROMENT."))

(defgeneric add-binding (name value binding)
   (:documentation "Create a new binding which is like BINDING but
   also has VALUE bound to NAME."))

The standard implementation of push-binding would generally be enough 
for whatever you wanted to do, and we'd provide standard methods which 
operate on lists (used by include), but you could, if the need arises, 
change any part of it.

--
Marco
Ring the bells that still can ring.
Forget the 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