[stringtemplate-interest] "rest" and template recursion

Terence Parr parrt at cs.usfca.edu
Sat May 31 16:39:53 PDT 2008


On May 30, 2008, at 11:30 PM, Zenaan Harkness wrote:

> On Fri, May 30, 2008 at 11:05:22PM -0700, Sasha Crosland wrote:
>> Thanks for the explanation, Terence.  A side-effect-free rest()  
>> does seem
>> more in the spirit of StringTemplate, doesn't it?  I vote yes, for  
>> what it's
>> worth.
>>
>> But would you actually need to make a copy of the list data?  If  
>> lists are
>> immutable within a template, then couldn't you easily return a  
>> lightweight
>> view of the sublist that reads through to the original list, just  
>> like with
>> an iterator?
>
> Vote thirded.
>
> Recursion ought to Just Work (TM).
>
> I additionally vote for an addition to first,last,rest to fill the  
> gap,
> perhaps "front" (all but last).

I think i have trunc for that.

> Lightweight container wrapper is definitely the go here.
> ArrayList.clone(), or Collection.clone() should do what's needed.

kewl. thanks.
Ter


More information about the stringtemplate-interest mailing list