[TransWarp] PROPOSAL: New peak.web.template terminology/explanation

Phillip J. Eby pje at telecommunity.com
Tue Jul 22 15:47:18 EDT 2003


At 09:21 PM 7/22/03 +0200, Roché Compaan wrote:
>What about
>
>     <table pwt:data="mydata" pwt:display="list">
>     <tr pwt:format="listItem">
>
>I missed "display" when I first scanned 'view' words and I really like it.
>It is intuitive and I can't think of any objections against using it. It
>sort of combines "view-as", it is quite distinct from the other two
>terms.

It's not bad, but now that I've seen how using only two tags cuts down on 
overhead, I like that way *much* better.


>Then why is it called DOMlet? I don't fully understand what a DOMlet
>does so maybe you can explain some more. The only thing I think of when
>I see DOMlet is the canonical DOM.

The idea was that a DOMlet is a "DOM-applet".  That is, it's an active 
component that generates XML/HTML document structure.  It does not use the 
canonical DOM API; but it *is* a document object model.  Each DOMlet 
corresponds to a (canonical) DOM node.  Attributes are about the only DOM 
nodes in PWT that don't get DOMlets created for them.


> > Okay, here's a radical idea.  Suppose we ditched the separate attributes,
> > and did *this*:
> >
> > <table pwt:domlet="list:mydata">
> > <tr pwt:define="listItem">
>
>Are you sure there are no use cases where 'data' and 'display'
>definitions can sensibly defined on different html tags.
>
>Is
>     <table pwt:data="mydata">
>     <tr pwt:display="list">
>     ...
>     <tr pwt:display="text">
>
>not very likely? I can't think of any examples now, just thought one
>should consider it.

If you did do that, it would be spelled:

<table pwt:domlet=":mydata">
<tr pwt:domlet="list">
...
<tr pwt:domlet="text">

While the ":mydata" thing looks a little bit weird, I think it's going to 
be rare, compared to e.g. "text:mydata" or "list:mydata" type usage.

I have to admit I'm also a little smug about us having a templating system 
that uses only two attributes.  :)  But PSO (http://pso.sf.net/) gets away 
with only *one* attribute!  (The equivalent of our domlet="", but without 
the :data part.)  Also I found out today that there is also a Java system 
called Tapestry that uses one-attribute component specs like this; it gets 
very high praise from people who need web design/programming roundtrip 
capability.


>The syntax is also very terse, it compresses more than the brain can handle
>with one look.

Hm, makes me wonder what you think of ZPT path expressions, what with their 
foo:bar:whatever|something/$else and all.  :)  (Yes, I'm being unfair to 
ZPT, since you could write a domlet that does exactly the same 
thing.  Heck, you could probably just make a DOMlet *use* the ZPT 
expression engine in order to do it!)

Also, I wonder whether you find:

     list(mydata)

in Python to "compress more than the brain can handle with one look".  When 
I was writing the post, I first thought of using that syntax, but was 
worried it would lead to assumptions about putting actual Python 
expressions in.  So I simplified it to:

     list:mydata

I'd have further simplified to:

     list mydata

except that then it would have been difficult to do the ":mydata" 
case.  Also, "list:mydata" seems to me to "feel like" URLs in PEAK, e.g. 
"sqlite://foo/bar", which basically indicate a type before the :, and 
type-specific parameters after it.  So, it seems a very PEAKish syntax in 
that way.  Also, the data portion *is* allowed to be a path, and so things 
like domlet="list:customer/transactions" is even more URLish.




More information about the PEAK mailing list