[Templates] Proposed change to splice vmethod

Andy Wardley abw@wardley.org
Fri, 20 Apr 2007 14:24:00 +0100


John Ingram wrote:
> The behavior of the splice vmethod seems to differ slightly from
> Perl's splice() in one minor way that I've seen. 

Yes, there is a difference in that you get an empty list rather than
an empty value.

One workaround is to add an "AND item.size" condition at the end:

   [% WHILE (item = mylist.splice(0,2)) AND item.size %]

I'll have a think about the implications of changing the vmethod to
return an empty value.  But either way, it'll be something for TT3.

Cheers
A