[stringtemplate-interest] separator: a fix or breaking backward compatibility?
Zenaan Harkness
zen at freedbms.net
Mon Jul 6 22:38:33 PDT 2009
On Mon, Jul 06, 2009 at 07:18:59PM -0700, Terence Parr wrote:
> On Jul 6, 2009, at 6:44 PM, Sterling Clover wrote:
> > What I think you really want is something closer to standard list
> > comprehension syntax, where a list is filtered on a condition. Since
> > this provides the same power as what you've got below, I don't think
> > it would hurt the logic/view split that stringtemplate enforces, and
> > it would make templates more concise and readable. Now as to what
> > the syntax is, that's a different issue. Something like the
> > following, perhaps?
> >
> > <names:{n: n.cool | n}; separator=",">
> >
> > The problem here is of course the colon is somewhat unintuitive, but
> > the standard set builder symbol for "such that" is the vertical bar,
> > which is already taken. Other suggestions, all equally not ideal,
> > follow:
> >
> > <names:{n st. n.cool | n}; separator=",">
> > <names:{n & n.cool | n}; separator=",">
> > <names:{n when n.cool | n}; separator=",">
> > <names:{n where n.cool | n}; separator=",">
> > <names:{n % n.cool | n}; separator=",">
> > <names:{n ^ n.cool | n}; separator=",">
> >
> > You get the idea.
>
> Yep. it's a good idea. The problem is that you might get multiple IF
> in a row that are "nullable". Or, you could ref an attribute that is
> a list with no elements.
>
> <foo : { f | <n>}; separator=", ">
>
> if foo is List<List<string>> and one of the List<string> is length 0,
> you'd want to avoid the extra separator, right?
Perhaps a good time to start looking at some standard lisp operators -
list concatenation, recursive function application/ conditional testing,
etc.
We're already seeing the fleshing out of first,last,rest,start functions
(or whatever they're called) - lisp is the original LISt Processor, of
course :)
Lisp is like the original pure state we all descended from, and are
slowly clamouring back to.
--
Homepage: www.SoulSound.net -- Free Australia: www.UPMART.org
Please respect the confidentiality of this email as sensibly warranted.
More information about the stringtemplate-interest
mailing list