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 [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
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:
_______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by robert.kuropkat
Hello Robert,
I also worked through that excellent book and hit the same problem, reported on this list under "Halt doesn't stop" in October. There seemed to be no simple solution to making the program behave just like the example in that book. Fortunately there are very few such issues in following all the examples! On Tue, 4 Feb 2020, 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 [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Nicola Mingotti
Thank-you for the response. The script you provided did not work exactly as you gave it to me, but I was able to create a similar
one. I will tinker a bit more with it. As you said, it can be instructive. The one thing that did not happen as you described though
was the slow down of execution. It just kept speeding on. It did pop up the window as expected, but as you pointed out, the UI was
unresponsive until I did the Ctrl-. which was very handy! I will continue to tinker with this and
perhaps construct my lesson based on your example here instead of what is in the book. Robert
Kuropkat P.S. Chris Game also replied that he hit the same snag and reported it awhile
back. I missed his original post, so will go back and look at it also. I may also tinker with other versions of Squeak to see if any of
them behave as described in the book. On Tue, 4 Feb 2020 19:07:59 -0800 Nicola Mingotti <[hidden email]> wrote: > > 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 >> [hidden email] >> http://lists.squeakfoundation.org/mailman/listinfo/beginners > > > -- > This email was Anti Virus checked by Astaro Security >Gateway. http://www.sophos.com _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by mechanic
Thank-you, I'll tinker with it more. Also, Nicola Mangotti posted a nice example I can substitute as a lesson for my class.
I'll also tinker some more with it and post anything useful I stumble upon. Robert
Kuropkat On Wed, 5 Feb 2020 11:04:38 +0000 (GMT Standard Time) Chris Game <[hidden email]> wrote: > Hello Robert, > > I also worked through that excellent book and hit the >same problem, > reported on this list under "Halt doesn't stop" in >October. There > seemed to be no simple solution to making the program >behave just > like the example in that book. Fortunately there are >very few such > issues in following all the examples! > > > On Tue, 4 Feb 2020, 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 >> >> >> >> > -- > This email was Anti Virus checked by Astaro Security >Gateway. http://www.sophos.com _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by robert.kuropkat
Hi Robert, I will inline comments:
Tinkering is the master way to learning: great. But, I usually copy and paste my examples, so, it should just work. You should definitely check examples in the last stable release of Squeak which at the moment is 5.2. From Amazon i see the 'Robot book' is old, 2006. It is a geological era in computer science. So, be ready to do a lot of tweaking. I would reccomend against learning on an older version of Squeak. Because when you will ask for help you will be in double-troubles.
Umm, consider a modern computer runs on the order of Ghz, that is, can do some 1,000,000,000 simple calculations per seconds. That program is counting to ~2,000 and you can see it! You shouldn't be able to see it progressing. The take home lesson here is 'if you want to be fast, don't print stuff, just compute' ;) Since you are preparing a lesson, you may compare the speed of printing and the speed of the program printing only even lines, then printing only 1/5 of the lines and so on. This knowledge is valid for all programming languages.
Great! Also, to the best understanding of your students, I would recommend not to use the local variables, but Workspace variables. They greatly increase the tinkerability of the snippets. See my notes here: https://wiki.squeak.org/squeak/6629 I have made a few videos for beginners in the last months which may be of help, see the list here: https://wiki.squeak.org/squeak/6624 bye Nicola
_______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |