[stringtemplate-interest] Renderer "modes"

Jeremy Gray jgray at siberra.com
Mon Jun 19 12:25:45 PDT 2006


Hmm. I hadn't realized that subclassing ST was an option, and admittedly
didn't gather that impression from your papers. Still, I am not having
an easy time imagining how auto-wrapping all dates would allow for the
conditional behaviour I was describing where a date might be formatted
one way once in a template and another way elsewhere. Perhaps something
just hasn't clicked in my mind yet. I'll have to think about it for a
bit.

Jeremy

-----Original Message-----
From: stringtemplate-interest-bounces at antlr.org
[mailto:stringtemplate-interest-bounces at antlr.org] On Behalf Of Terence
Parr
Sent: Monday, June 19, 2006 11:45 AM
To: stringtemplate-interest
Subject: Re: [stringtemplate-interest] Renderer "modes"


On Jun 19, 2006, at 11:34 AM, Jeremy Gray wrote:

> Ack. Sorry, we're not in a position to be subclassing dates to provide
> for alternate formatting.

Just wrap the dates in an object that delegates.  getMedium() would  
call the formatted on the wrapped object. :)

> In some cases, it is even the exact same
> DateTime instance being rendered two different ways. In any case, I
> can't/won't change the model. Is this not precisely the kind of usage
> that the renderer approach should be allowing us to address in a  
> manner
> transparent to the model?

No need for a renderer really...just wrap automatically by  
subclassing StringTemplate and having it auto-wrap all Dates. :)   
Works great.

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