[stringtemplate-interest] String manipulations

Jeremy Gray jgray at siberra.com
Tue Sep 5 17:03:19 PDT 2006


Agreed. I just had to play the role of Terence for a moment. ;)

Jeremy

-----Original Message-----
From: stringtemplate-interest-bounces at antlr.org
[mailto:stringtemplate-interest-bounces at antlr.org] On Behalf Of Terence
Parr
Sent: Tuesday, September 05, 2006 4:20 PM
To: stringtemplate-interest
Subject: Re: [stringtemplate-interest] String manipulations


On Sep 5, 2006, at 11:41 AM, Jeremy Gray wrote:

> Terence, if such functions were to be provided in a standard  
> library of
> StringTemplate, wouldn't they essentially become considered part of  
> the
> language and start ST down the slippery slope that you've mentioned so
> many times in your whitepapers and presentation materials?

hi Jeremy, an excellent question and I am glad that people are  
defending this principle! I think I said it best in the enforcing  
separation paper (section "8.1 ttribute rendering"):

"...formalizing the renderer and encapsulating rendering operations  
into an application independent service allows the renderer for a  
given target language such as HTML to be supplied with an engine.  
Because the renderer will not be part of a specific application, it  
cannot constitute an entanglement of an application's model and view.  
Technically a programmer could alter the HTML renderer or attach a  
"malicious" renderer that altered a specific model's data, but that  
risk already exists: someone could easily alter the source for a  
strict engine to allow violations."

That said, one should be careful because you are starting down a  
slippery slope.  You could for example pass data to a function that  
was really a Python interpreter that understood the parameter to be a  
string containing a Python program.  That would be bad.  I think if  
we stick to escaping text for HTML and two or three other functions  
we will be okay.  In a sense converting a 32-bit binary integer to a  
string of ASCII characters via toString() is already one of these  
kinds of computations.  As long as they are built-in, I don't have a  
big problem with it.  I start to really object when people want to  
call their own code because then we have totally destroyed for  
separation.  If you cannot call your own model, I think we are still  
okay.  Agree?  Disagree?

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