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

Phillip J. Eby pje at telecommunity.com
Tue Jul 22 13:07:07 EDT 2003


At 12:37 PM 7/22/03 -0400, Ty Sarna wrote:
>Oops, sent the last message privately -- I proposed "layout" as a
>possible replacement for "as". Works well for plural data, less well for
>singular.
>
>But I had another thought...  "view" is out, and there is resistance to
>"as"....  but what if we combine them into "view-as"?  It's intuitively
>familiar from GUIs, especially file managers, and it seems to partially
>mitigate the issue with "view" being overloaded. Though now that I think
>of it in context, "show:view-as" sounds very clunky. Hmm... and for that
>matter, so is "show:view".
>
>I guess at this point "as" is my first choice, and "widget" my runner-up
>if people feel strongly that it must be a noun.

I might not be opposed to view-as, we'd just need to drop 'show' as the 
example prefix.  Data and format work okay with any prefix.  So then we'd have:

<table pwt:data="mydata" pwt:view-as="list">
<tr pwt:format-of="listItem">
...

I think I like "layout" better than view-as, however, even though it seems 
a little odd for certain uses; e.g. layout="translate"!  Also, ironically 
it means the opposite of what it says.  Really, the HTML is what is really 
controlling the layout, the DOMlet is just merging data and the template.

Some other thoughts: 'xform' (like transform, but shorter; OTOH it might be 
confused with XForms technology), 'adapter', 'lens', 'render-as', 
'style-as' (style is a common HTML attribute).

'adapter' is somewhat interesting, since it sounds like something our 
hypothetical deep-frozen developer might get.  OTOH, if we want to go COBOL 
all the way, then 'data', 'use-format', and 'define-format' might be the 
best bets.  A little more modern would be 'data', 'format-as' and 
'format-of', but this may be more difficult for non-native English speakers 
to distinguish.

*Sigh*.  All of these are pretty verbose.  It's somewhat ironic, as you'd 
think PWT would involve less overall typing than a ZPT, but for certain 
common idioms ZPT and suchlike scripting systems are more compact, because 
they can devote an attribute to a particular use.  We have to specify both 
the data and DOMlet in order to do anything.  There's less *typing* in a 
PWT as a whole, but more of the typing that you *do* have to do, is 
overhead (i.e. not relevant).  Thus, it's perceived differently.

Okay, here's a radical idea.  Suppose we ditched the separate attributes, 
and did *this*:

<table pwt:domlet="list:mydata">
<tr pwt:define="listItem">

That is, name the domlet before the ':', and the data afterwards.  Or to be 
more precise, you can use any of the following:

domlet="domletclass:datapath"
domlet="domletclass:"
domlet="domletclass"
domlet=":datapath" (uses current default domlet type)

Then, the other tag is said to "define" a value used by the nearest 
surrounding explicit DOMlet.  (That is, one with a non-empty domletclass 
specified.)

Now there would be only *two* attributes to worry about, both are explicit, 
there's less typing overhead, and instead of two kind-of-similar attributes 
and one that's different, we have two very-distinct ones.  One is a noun, 
the other a verb.  And, if domlet classes are named in a verbish way, then 
saying things like domlet="translate:mytext" make a lot more sense.  Also, 
we could more easily say that it's up to the DOMlet to interpret the data 
following the ':', although that might be a downside if it leads to people 
making domlets like 'python:some expression'!





More information about the PEAK mailing list