[Newbies] halt method not halting execution...?
Nicola Mingotti
nmingotti at gmail.com
Wed Feb 5 03:07:59 UTC 2020
Hi,
I never red the book of Robots, but I see a lot of people name it.
Anyhow, here is a simple script that loops over integers and stops
when it reaches the arbitrary number "1567". It stops by opening
a debugger.
In the debugger look for UndefinedObject>>doIt to see your code.
This script is an example of bad code. Indeed it will lock your
interface until it finishes its jobs. And, if you look in the Transcript
window you will see the counting is going on very very slowly.
But, being so bed is instructive, because you can try to call the
debugger with Alt+. (try also Ctrl+. or Cmd+. it depends on the OS) in
cases like this, when the interface gets stuck. Many times you are going
to save your session ;)
|i|
i := 0.
[true] whileTrue: [
i := i + 1.
(i = 1567) ifTrue: [self halt].
Transcript ensureCr; show: ('number: {1}' format: {i.}).
].
bye
Nicola
On 2/4/20 10:16 AM, Robert Kuropkat wrote:
> All,
>
> I am working my way through the Squeak: Learn Programming with Robots
> and I hit some unexpected behavior with the halt method in Chapter 15.
> I am not at that computer at the moment so cannot say exactly which
> 3.x version of the VM I am using. It is using the Ready.image and the
> V3.sources files.
>
> According to the book, the halt method should cause execution to stop
> and invoke the debugger. It does in fact invoke the debugger,
> however, it also skips past and keeps executing. Is there by chance
> some setting somewhere telling the program to skip that method and
> keep executing?
>
> I can follow-up later tonight with better details, but thought I'd
> through the question out in case there was in fact an easy answer...
>
> Robert Kuropkat
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20200204/b3f58348/attachment.html>
More information about the Beginners
mailing list