[stringtemplate-interest] maps, length, wrapping

Kay Roepke kroepke at dolphin-services.de
Sat Jan 28 15:40:46 PST 2006


On 29. Jan 2006, at 0:07 Uhr, Terence Parr wrote:

> Bugging is probably only way to get anything done during the  
> semester ;)

in this matter, i mean ;)

> So <length(names)> is the answer, right?  It will yield a string  
> with 0, 1 or n for any attribute.  Iterable ones get walked and  
> counted (slow but general).  Also we want <m:{key | <key>, <m.(key) 
> >}> for walking maps, right?

That sounds reasonable to me. The iteration approach isn't ideal,  
granted, but was the quick-and-dirty way :)
I'd say to go that way now and get concerned with it if it's too slow  
for people.

> How can we insert a newline when length is greater than 80?   
> Technically
>
> <if(length(names)>80)><\n><endif>
>
> doesn't break the rules but then I must do flow analysis to prevent  
> you from testing attribute values.

While that would be sweet to have, I'm not convinced that we really  
need it now.
If we want it now, shouldn't it be easy to test for it? One side can  
only be length() and the other can only be a constant?
Though I might be missing something really obvious...

-k



More information about the stringtemplate-interest mailing list