[stringtemplate-interest] dealing with empty list values

Terence Parr parrt at cs.usfca.edu
Mon Jun 5 11:57:24 PDT 2006


On Jun 4, 2006, at 9:54 AM, Kenny Cockburn wrote:

> Hi,
>
> Here are my thoughts
>
> as a newbie to ST I would have assumed that I would have got ALL  
> members of the list and it was my responsibility to check for a  
> null member

Hi Kenny,

Well, that is not the ST way I think.  For example,

$data$

prints nothing instead of null when it's missing.  No need to test  
for null.  Further, the following prints nothing upon null list

$names:{n| <i>$n$</i>}$

It works if there are 0, 1, or n values.

> I like the 'noskip' option on a list iterator  but would like to  
> add a ( Global or Instance )  property  to a StringTemplateGroup to  
> indicate wither it was to skip or not to skip null members of a  
> list this makes it  the responsibility of the invoker to decide the  
> default behavior but it would require  both a 'nopskip' and 'skip'  
> option on the iterator.

Yep, i'll have to think about this.
Ter


More information about the stringtemplate-interest mailing list