Characterizing StringTemplate
ST is a dynamically typed, pure functional language with dynamic scoping and lazy evaluation. Those fancy terms highlight some important characteristics, so let’s define them:
-
Dynamically typed: ST uses toString to convert attributes to string values. Since all Java objects answer this method, ST works with any Java object. Also, if you ask for property b of attribute a (with a.b), it’s up to you to make sure attribute a has that property at run-time. Python and Ruby programmers should feel very much at home.
-
Pure functional: All expressions are side-effect free. There’s no direct way for ST to alter data values or data structures that we pass in. (Well, you could code a toString method to erase the hard drive, but ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access