[stringtemplate-interest] Support or interface Iterable
John Snyders
jjsnyders at rcn.com
Thu Oct 19 07:35:00 PDT 2006
That explains it, thanks.
I didn't notice that Iterable was new in 1.5. That makes sense since it
seems to go hand in hand with the new foreach syntax.
At least some parts of stringtemplate are generated from ANTLR so is it
possible/difficult to have a 1.5 version of StringTemplate spit out? Are
there other things worth taking advantage of? Probably most new things don't
impact the StringTemplate implementation.
-John
> -----Original Message-----
> From: stringtemplate-interest-bounces at antlr.org
> [mailto:stringtemplate-interest-bounces at antlr.org]On Behalf Of Terence
> Parr
> Sent: Wednesday, October 18, 2006 6:04 PM
> To: StringTemplate
> Subject: Re: [stringtemplate-interest] Support or interface Iterable
>
>
>
> On Oct 18, 2006, at 9:31 AM, John Snyders wrote:
>
> > Is there a reason why string template does not allow the iteration
> > syntax <attribute:{template}> for things that are Iterable but not
> > a collection?
>
> It should, I see:
>
> private static Object
> convertAnythingIteratableToIterator(Object o) {
> ...
> else if ( o instanceof Iterator ) {
> iter = (Iterator)o;
> }
> ...
> }
>
> > The methods convertAnythingToIterator and
> > convertAnythingIteratableToIterator in ASTExpr.java do allow
> > Collection but do not allow Iterable.
>
> Ohhhhh! You mean Iterable rather than Iterator? That is a java 1.5
> thing, which I cannot use because 1.3, 1.4 don't have it. E.g., I
> use 1.4 not 1.5.
>
> Ter
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
More information about the stringtemplate-interest
mailing list