[Templates] tt annoyances

Randal L. Schwartz merlyn@stonehenge.com
09 Oct 2003 15:58:14 -0700


>>>>> "Mark" == Mark D Anderson <mda@discerning.com> writes:

Mark> Keep in mind this is with the best of intentions; I'm sure TT is the most
Mark> mature of the "mini-language" school of perl templating solutions.

But don't misunderstand what TT is about.  I think perhaps you are.
You deliberately don't *want* TT to be a full programming language.
It has *just enough* to do most tasks.

Mark> 2. There is no "typeof" or "instanceof" operator (or similar).
Mark> Perl has "ref" and "isa"; practically all real programming languages
Mark> have at least one of those operators.

Right.  TT doesn't need it.  TT is not a "real programming language".
It's a language for translating a data structure into a view of that
data structure.  That's all.  If you want polymorphism, put it into
the objects you feed into the template.  Don't pollute TT into that.

Mark> 5. The iterator objects/methods are not generic.

There's some planned unification in TT3.

Mark> 6. You can't call methods directly on literals, for example
Mark> [% 'asdf'.length %] or [% [1,3,2].sort %].

Why would you want to? :)

Mark> 9. The diagnostics stink. (This was a topic of an earlier email post.)

Understood and agreed.  But again, the TT code is supposed to be small
compared to your data-generating code.

Mark> 10. Boolean interpolation is non-obvious. [%1==2%] interpolates
Mark> as '', and [%2==2%] interpolates as '1'.

Actually, that's precisely what Perl is returning.  Brilliant!

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!