<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 4/11/23 11:19 AM, Gerald Klix via
Cuis-dev wrote:<br>
</div>
<blockquote type="cite"
cite="mid:18b6f9a9-ce5d-d1b6-7ae9-21b05ef759ce@klix.ch">On 4/10/23
3:46 PM, Juan Vuletich wrote:
<br>
<blockquote type="cite">On 4/8/2023 7:45 PM, Gerald Klix via
Cuis-dev wrote:
<br>
<blockquote type="cite">Hi all, Hi Juan,
<br>
<br>
Is there a chance, that you may accept this little change set?
<br>
It brings back `self break`, to which I got used over time,
<br>
using Squeak, Pharo and Cuis.
<br>
<br>
Needless to say, that added some improvements.
<br>
<br>
<br>
HTH and Best Regards,
<br>
<br>
Gerald
<br>
</blockquote>
<br>
Nice. But this serves the same purpose as #halt, right? Does it
make sense to have both? Does your implementation have any other
advantage besides saving a couple of clicks in the debugger? Is
forking a new process needed?
<br>
<br>
Thanks,
<br>
<br>
</blockquote>
Well,
<br>
it has one, probably tiny, advantage:
<br>
The stack frame with the #break-send is not displayed.
<br>
I considered it a bit annoying, that I have to step over this
<br>
stack-frame – that's what I believed.
<br>
<br>
However during the course of the implementation
<br>
of #break, I found that there is code that enables the
<br>
debugger to 'single-step' and 'step over'
<br>
in all frames, not only in the top-frame.
<br>
(I used the debugger to single-step the debugger)
<br>
I hope this cool feature is documented somewhere
<br>
and I fear that I overlooked it in a every other
<br>
Smalltalk I used so far.
<br>
<br>
<br>
There is also another feature, that may be an advantage
<br>
or a big nightmare: The implementation isn't based
<br>
on exceptions, you can not 'subvert' it with an
<br>
exception handler.
<br>
<br>
<br>
Concerning #halt, its category talks about errors,
<br>
not about debugging. We should have a common
<br>
understanding of the pragmatics of halt vs. break.
<br>
(Operational) semantics are clear, as you pointed
<br>
out: Both leave you in the debugger.
<br>
<br>
There are several sends of #halt in the pristine
<br>
Cuis image. IHMO most signal some unspecified
<br>
error condition. See Morph>>#copyForClipboard
<br>
for a counter-example :-}
<br>
<br>
<br>
Just my 1€,
<br>
<br>
Gerald
<br>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
</blockquote>
I had some time to think things over.<br>
<tt>#halt</tt> should not do the same as <tt>#break</tt>.<br>
<br>
There is a case I forgot to consider in my<br>
break implementation: What should we do,<br>
if we run in a 'production'-environment (vs.<br>
'development'-environment).<br>
<br>
There is <tt>SystemDictionary>>#isDevelopmentEnvironmentPresent</tt><tt><br>
</tt>which, IHMO, uses the correct criteria and is<br>
used when handling unhandled (pun intended)<br>
exceptions:<br>
<br>
<tt>UnhandledError>>#defaultAction</tt><tt><br>
</tt><tt><br>
</tt><tt>defaultAction</tt><tt><br>
</tt><tt> "The current computation is terminated. The cause of
the error should be logged or reported to the user. If the program
is operating in an interactive debugging environment the
computation should be suspended and the debugger activated."</tt><tt><br>
</tt><tt><br>
</tt><tt> Smalltalk isDevelopmentEnvironmentPresent</tt><tt><br>
</tt><tt> ifTrue: [ self devDefaultAction ]</tt><tt><br>
</tt><tt> ifFalse: [ self standaloneAppDefaultAction ]</tt><tt><br>
</tt><tt><br>
</tt>In the case of no development environment <tt>standaloneAppDefaultAction<br>
</tt>is sent<tt>, </tt>which terminates – without further ado, <br>
directly using the primitive – <br>
the image after writing a log messages<tt>.<br>
</tt>(Side note: It should delegate the handling to an installed
application<tt>)</tt><tt><br>
</tt>In fact it executes:<tt><br>
Smalltalk logError: self description inContext: self
signalerContext to: 'CuisDebug'.<br>
</tt>If <tt>#halt</tt> was meant for debugging purposes, it should<br>
not log an error and should not quit the image<br>
in a production environment.<br>
(Squeak does more or less the same, with much more fuss)<br>
<br>
Conclusion: The original intention (pragmatics) was to signal a<br>
(probably fatal) error.<br>
<br>
<br>
Concerning <tt>#break</tt>:<br>
<br>
In a production environment, <tt>#break</tt> must have no effect.<br>
It is desirable that writes some log message, complaining<br>
about leftover debug code, but things should work as<br>
if there was no debug code present.<br>
<br>
I hope the community can agree on this distinction<br>
and that we can change the implementation of <tt>#break</tt><br>
accordingly.<br>
<br>
<br>
Just another 1 SFr,<br>
<br>
Gerald<br>
<br>
<br>
<tt><br>
<br>
</tt><tt></tt><br>
</body>
</html>