> So anyway, can I get, I dunno, a ruling, or something?  I've had fun
> knocking together the basic implementation, and I'm happy to do the rest of
> the gruntwork to get a maximally-compliant, fully-tested alternative
> implementation out the door, but only if I know my effort won't be wasted.
> If anyone wants to help out, great; I'm not wedded to the idea of doing it
> all myself.

I don't have time to help you directly.  But you may consider looking at 
CGI::Ex::Template which provides an engine that handles the entire TT2 and 
most of TT3 syntax.  It contains its own grammar, executor, and opcode tree 
syntax - and should be relatively easy to port (I ported the codebase to XS 
in a few days).

CGI::Ex::Template is faster in a non-cached situation (start from dry) and is 
only slower than Template::Toolkit 2 if used in a mod_perl situation with 
Stash::XS and lots of looping.  I actually sat down a year ago and made a 
CGI::Ex::Template::XS version that was a few percent faster even than 
Stash::XS under mod_perl -- but the amount of excitement on the list of a 
non-Template-Toolkit TT2 engine was lackluster.  (which by the way if anybody 
is interested I can release the XS version - but there are two memory holes 
in rarely used named filter areas).

One thing that would've been nice to have then and would really be nice now 
would be to swap out the testing of the language from the implementation.  
Template::Toolkit has many special variables that affect the engine that 
don't directly pertain to the language syntax.  The test suite also depends 
on the internals of the TT engine (it isn't completely blackboxed).  I was 
able to make CGI::Ex::Template pass 100% of the TT2.15 test suite but I had 
to make a custom interface module that handled the TT2 extras and did things 
like actually "use Template::Exception" since several of the tests just 
assume that it would be there.

The test suite that comes with CGI::Ex::Template allows you change a variable 
at the top of the file and it will play all of the tests using Template 
rather than CGI::Ex::Template which was very nice for checking for sanity.  
While this is nice, it still isn't language agnostic enough.

What I'd like to see more would be a directory of input and output files, that 
are static text with no code in them that could be read by the test suite, 
processed and compared to the static output files.  The input files could 
contain the standard TT configuration values using something like YAML or 
JSON.  The sort of file I'd imagine would be something like:

###----------------------File chomp_test.yaml-----------------------------
---
name: Test of PRE_CHOMP configuration
config:
  PRE_CHOMP: '-'
  VARIABLES:
    foo: 'is'
input: >
  This
  [% foo %]
  a test.
output: >
  This is
  a test.
---
name: Test of POST_CHOMP configuration
config:
  POST_CHOMP: '-'
  VARIABLES:
    foo: 'is'
input: >
  This
  [% foo %]
  a test.
output: >
  This
  is a test.
###----------------end of file--------------

The benefits to using a test suite like this is that it is language agnostic.  
The Perl TT, and Perl CGI::Ex::Template, and Python, and PHP, and Parrot, and 
whatever implementations could all use the same test suite.  The one downside 
is that then TT requires YAML but only for testing.

Anyway - just my two cents.

Paul Seamons

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to