At 10:46 AM 10/8/02, Greg Ward wrote:
>IOW, I would favour
>
> def foo(...):
> define a regular function
>
> template foo [plain] (...):
> define a template that returns plain (un-marked-up, needs-to-be-
> quoted-if-included-in-HTML) text
>
> template foo [html] (...):
> define a template that returns HTML text
I agree with Greg on distinguishing templates, which return concatenated
expression values, and functions, which return None or some specified value.
As I understand Neil's original proposal, within templates literal strings
were promoted to his HTMLMarkup type. When HTMLMarkup is concatenated
with a string, that string first is HTML quoted; the result is more HTMLMarkup.
With HTMLMarkup renamed simply html,
template foo [html] (...):
specifies that literal strings should be promoted to html objects. It
seems to me that
template foo [plain] (...):
should promote literal strings to plain objects and
template foo [xyz] (...):
should promote literal strings to xyz objects. (Of course, xyz objects
should support an interface allowing concatenation with string objects.)
I recommend
template foo [str] (...):
instead of
template foo [plain] (...):
because literal strings should be promoted to str objects. (Perhaps the
compiler can optimize away the promotion of a str to a str.)
--
Joel Shprentz (703) 478-9668
1516 Park Glen Court jshprentz@his.com
Reston, VA 20190