<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.apple-style-span
        {mso-style-name:apple-style-span;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple style='word-wrap: break-word;
-webkit-nbsp-mode: space;-webkit-line-break: after-white-space'>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>It&#8217;s true you&#8217;d need to unconditionally pass things
to the listener, but it seems a worthwhile tradeoff.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>My concern mainly comes from maintenance programming.&nbsp; Even
conditionally not sending events means that a maintenance programmer could be
doing:<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>EventHandler() {<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'>onMalformedTemplate(&#8230;)
{<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'>&#8230;<br>
}<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'>onMissingTemplate(&#8230;) {<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'>&nbsp;// Maintenance
programmer:&nbsp; ST4 is BORKED!&nbsp; It says to add this handler to handle
missing Templates, so I did this, but the event NEVER FIRES.&nbsp; Filing a bug
report with Terrence now!<o:p></o:p></span></p>

<p class=MsoNormal style='margin-left:.5in'><span style='font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'>}<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>}<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>When the original programmer did (in a far away piece of code):<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>// just ignore missing templates in prod.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>//STStatic.setEventList(MALFORMED_TEMPLATE | MISSING_TEMPLATE);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>STStatic.setEventList(MALFORMED_TEMPLATE);<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>As always, there will no doubt be a chorus of &#8220;RTFM&#8221;,
but I think it is reasonable to expect a library to pass all of the events to
the listener, all the time, and I can decide which ones I care about and how I
choose the proceed.&nbsp; <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I understand some folks wish to silently ignore missing
templates, while others need alerts, and others need Exceptions.&nbsp; Still, I
think the behavior of the library should be absolutely deterministic (ST4 will
fire an event on all warnings or errors) and then let the library user decide
how to interpret based on their situation.&nbsp; In other words, ST4 is about
being a great template engine, not about being a configuration system for error
handling.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Of course, folks can still argue about on&lt;Event&gt;() versus
onEvent(EVNT_TYPE, &#8230;), but I&#8217;ll steer clear of that one.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Jim<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Terence Parr
[mailto:parrt@cs.usfca.edu] <br>
<b>Sent:</b> Tuesday, December 01, 2009 12:22 PM<br>
<b>To:</b> Brain, Jim<br>
<b>Cc:</b> stringtemplate-interest@antlr.org List<br>
<b>Subject:</b> Re: [stringtemplate-interest] which ST errors are serious<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<div>

<div>

<p class=MsoNormal><span style='font-size:13.0pt'>On Dec 1, 2009, at 7:55 AM,
Brain, Jim wrote:<o:p></o:p></span></p>

</div>

<p class=MsoNormal><span style='font-size:13.0pt'><br>
<br>
<o:p></o:p></span></p>

<div>

<p class=MsoNormal><span style='font-size:13.0pt'>If you have a listener
concept in v4 and will pass the errors to the listener, it seems to me that
someone who needs Exceptions can just throw the exception in the listener.<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:13.0pt'><o:p>&nbsp;</o:p></span></p>

</div>

<p class=MsoNormal><span style='font-size:13.0pt'>That's true. they can decide
what's fatal. i'll have to pass more info to the listener this way though and
can't manage a bitset of what to pay attention to.<o:p></o:p></span></p>

</div>

<div>

<p class=MsoNormal><span style='font-size:13.0pt'><br>
<br>
<o:p></o:p></span></p>

<div>

<p class=MsoNormal><span style='font-size:13.0pt'>Is it common in systems to
have a &quot;conditional Exception system&quot; like this, where the same
conditions may or may not throw Exceptions depending on some configuration
setting? &nbsp;If so, I'm unfamiliar with it. &nbsp;From a language
perspective, I much prefer Exceptions either be &quot;always&quot; or
&quot;never&quot;, not &quot;optional&quot;<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<div>

<p class=MsoNormal><span class=apple-style-span><span style='font-size:13.0pt'>Well,
in many ways it's a way to specify language semantics depending on your
situation. Some rely on &lt;a.b&gt; being valid when b doesn't exist.
&nbsp;Some people consider it a programming error. &nbsp;Both use cases are
valid.&nbsp;</span></span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal><span class=apple-style-span><span style='font-size:13.0pt'>As
u say, maybe pass everything to listener and it can decide...</span></span><o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal><span class=apple-style-span><span style='font-size:13.0pt'>Ter</span></span><o:p></o:p></p>

</div>

</div>

</body>

</html>