<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Jan 17, 2015 at 4:03 PM, Eliot Miranda <span dir="ltr">&lt;<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi,<div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Sat, Jan 17, 2015 at 10:35 AM, Eliot Miranda <span dir="ltr">&lt;<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Frank,<br>
<span><br>
On Jan 17, 2015, at 3:39 AM, Frank Shearar &lt;<a href="mailto:frank.shearar@gmail.com" target="_blank">frank.shearar@gmail.com</a>&gt; wrote:<br>
<br>
&gt; On 16 January 2015 at 21:44,  &lt;<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>&gt; wrote:<br>
&gt;&gt; Chris Muller uploaded a new version of System to project The Trunk:<br>
&gt;&gt; <a href="http://source.squeak.org/trunk/System-cmm.694.mcz" target="_blank">http://source.squeak.org/trunk/System-cmm.694.mcz</a><br>
&gt;&gt;<br>
&gt;&gt; ==================== Summary ====================<br>
&gt;&gt;<br>
&gt;&gt; Name: System-cmm.694<br>
&gt;&gt; Author: cmm<br>
&gt;&gt; Time: 16 January 2015, 3:44:19.079 pm<br>
&gt;&gt; UUID: e79a2347-2f40-4fec-8f00-f67ecad68491<br>
&gt;&gt; Ancestors: System-dtl.693<br>
&gt;&gt;<br>
&gt;&gt; - #flush stdout and stderr after writing error information to them.<br>
&gt;&gt; - After that, if the exception is resumable (i.e. a Warning), resume it.  Except if its a MessageNotUnderstood -- that is not an error you want to resume in a headless environment.<br>
&gt;<br>
&gt; Why? It&#39;s probably a rare use case for a #run: script to catch MNUs to<br>
&gt; do something fancy, I guess? Maybe it&#39;s because #run: is usually<br>
&gt; (always?) the top level of the program?<br>
<br>
</span>One reason is that resuming an MNU simply resends from the diesNotUnderstand: method, so resuming will result in infinite recursion.  I suppose the handler could allow one repeat but that seems arbitrary.  There&#39;s nothing to stop one including a resuming MNU handler in the expression if one wants to override the default behaviour.<br>
<span><br>
&gt;<br>
&gt; Catching only MNUs seems very specific. Maybe there could be a #run:<br>
&gt; version that says &quot;and here&#39;s a function you can use to control which<br>
&gt; exceptions are OK to resume, and which not&quot;?<br>
<br>
</span>Well there is Notification and Warning but (rightly) MessageNotUnderstood is an Error.  Reporting Notifications and Warnings to the output and continuing, but aborting for other exceptions seems the right thing to do, rather than basing it in resumability, yes?  What am I missing?<br>
<br>
Whether an exception is resumability or not is to do with whether one can usefully provide a value with which to continue, not to do with the severity of the error.  For example, being able to resume with nil for a permissions violation when opening a file or directory might make it really easy to implement a find(1) like search over directories where some may be unreadable due to permissions.  Being able to resume doesn&#39;t make the permissions violation any the less severe, but it dies give us a nice way if handling it, certainly less complex than having to explicitly check for permissions during the traversal.  Likewise, being able to substitute a value for an MNU allows all sorts of conveniences, eg see my code for disassembling methods to bytecode messages.<br>
<br>
So IMO the system should be reporting Notifications and Warnings and aborting for anything else.<br>
<br>
&gt;<br>
&gt; frank<br>
<br>
Eliot (phone)</blockquote><div><br></div></div></div><div>See the Error handler in <span style="color:rgb(0,0,0);font-size:13px">SmalltalkImage&gt;&gt;run:</span></div><span class=""><div><br></div><div> <span style="color:rgb(0,0,0);font-size:13px">               on: Error</span></div><span style="color:rgb(0,0,0);font-size:13px">                do:</span><br style="color:rgb(0,0,0);font-size:13px"><span style="color:rgb(0,0,0);font-size:13px">                        [ : err | err printVerboseOn: FileStream stderr.</span><br style="color:rgb(0,0,0);font-size:13px"><span style="color:rgb(0,0,0);font-size:13px">+                       FileStream stderr flush.</span><br style="color:rgb(0,0,0);font-size:13px"><span style="color:rgb(0,0,0);font-size:13px">+                       (err isResumable and: [ (err isKindOf: MessageNotUnderstood) not ])</span><br style="color:rgb(0,0,0);font-size:13px"><span style="color:rgb(0,0,0);font-size:13px">+                               ifTrue: [ err resume ]</span><br style="color:rgb(0,0,0);font-size:13px"><span style="color:rgb(0,0,0);font-size:13px">+                               ifFalse: [ self haltOrQuit ] ]!</span><br style="color:rgb(0,0,0);font-size:13px"><span style="color:rgb(0,0,0);font-size:13px">-                       self haltOrQuit.</span><br style="color:rgb(0,0,0);font-size:13px"><div><span style="color:rgb(0,0,0);font-size:13px">-                       err isResumable ifTrue: [ err resume ] ]!</span> </div></span></div><br><br>IMO, this should read<br clear="all"><div><br></div><div><div><span style="color:rgb(0,0,0);font-size:13px">               on: Error</span></div><span style="font-size:13px;color:rgb(0,0,0)">               do:</span><br style="font-size:13px;color:rgb(0,0,0)"><span style="font-size:13px;color:rgb(0,0,0)">                        [ : err |</span></div><div><span style="color:rgb(0,0,0);font-size:13px">                       </span><span style="color:rgb(0,0,0);font-size:13px">  </span><span style="font-size:13px;color:rgb(0,0,0)">err printVerboseOn: FileStream stderr.</span><br style="font-size:13px;color:rgb(0,0,0)"><span style="font-size:13px;color:rgb(0,0,0)">                         FileStream stderr flush.</span><br style="font-size:13px;color:rgb(0,0,0)"><span style="font-size:13px;color:rgb(0,0,0)">                         </span><span style="font-size:13px;color:rgb(0,0,0)">self haltOrQuit</span><span style="font-size:13px;color:rgb(0,0,0)">]!</span> </div><div><br></div><div>Resuming is definitely not safe; it could cause the software to attempt something damaging right?  And whatever is caught here is an error, no haltOrWuit is the only valid response, no?  I&#39;m happy to make the change.</div></div></div></blockquote><div><br></div><div>Actually, I think I should put it back to my original code.</div><div><br></div><div><div><div><span style="color:rgb(0,0,0);font-size:13px">               on: Error</span></div><span style="font-size:13px;color:rgb(0,0,0)">               do:</span><br style="font-size:13px;color:rgb(0,0,0)"><span style="font-size:13px;color:rgb(0,0,0)">                        [ : err |</span></div><div><span style="color:rgb(0,0,0);font-size:13px">                       </span><span style="color:rgb(0,0,0);font-size:13px">  </span><span style="font-size:13px;color:rgb(0,0,0)">err printVerboseOn: FileStream stderr.</span><br style="font-size:13px;color:rgb(0,0,0)"><span style="font-size:13px;color:rgb(0,0,0)">                         FileStream stderr flush.</span><br style="font-size:13px;color:rgb(0,0,0)"><span style="font-size:13px;color:rgb(0,0,0)">                         err isResumable ifTrue: [ </span><span style="font-size:13px;color:rgb(0,0,0)">self haltOrQuit ] </span><span style="font-size:13px;color:rgb(0,0,0)">]!</span> </div></div><div><br></div><div>That way, if its headless, it&#39;ll exit every time.  If it&#39;s headful, the user will have the chance to fix the Error before clicking Proceed in the debugger.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><span class=""><font color="#888888">-- <br><div>best,<div>Eliot</div></div>
</font></span></div></div>
<br><br>
<br></blockquote></div><br></div></div>