MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Can't abort a loop with Print inside (V6)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83119] Re: [mg83089] Re: Can't abort a loop with Print inside (V6)
  • From: Bo Hu <bhu at cvs.rochester.edu>
  • Date: Mon, 12 Nov 2007 05:09:27 -0500 (EST)
  • References: <200711100842.DAA00815@smc.vnet.net>

This is not about a loop running faster than one could stop it before  
it ends.  The simple loop runs for quite a few seconds on my Macbook  
Pro, because of the Print statement.  It appears to be improper  
synchronization between the kernel and the front end.  More like a  
misfeature if that's the intended behavior.

Frank

On Nov 10, 2007, at 3:42 AM, Bill Rowe wrote:

> On 11/9/07 at 5:15 AM, frank1998 at gmail.com (Frank Hu) wrote:
>
>> It seems in Version 6 one can't abort  a loop if there's a Print
>> statement inside.  Try the following code
>
>> For[i = 1, i < 1000, ++i, Print[i]]
>
>> No matter doing it from the menu or with the keyboard shortcut, the
>> abort action will be ignored.  Under 5.2, the code stops right away
>> when I hit Cmd-.
>
>> Sometime, trying to abort would even freeze the whole program,
>> causing lost sessions.  I'm running 6.0.1.0 on Mac OS X
>> 10.4.10. Any suggestions of what's going on?  Is this a bug or
>> a new feature?
>
> It would be better described as a feature than a bug. But the
> "feature" is really nothing more than improved performance of
> version 6 compared to previous versions rather than an intent to
> prevent stopping a loop using Cmd-.
>
> For any software (assuming good performance) it will be always
> possible to write a loop that runs so fast that it simply cannot
> be halted using the key sequence. This is a result of only
> having a simple Print statement in the loop rather than having a
> more complex loop.
>
> For example, the loop
>
> Do[Pause[1];Print[n],{n,100}]
>
> can easily be halted with the Cmd-. key shortcut.
>
> OTOH,
>
> Do[Print[n],{n,100}]
>
> cannot be halted in the same manner.
> --
> To reply via email subtract one hundred and four
>



  • Prev by Date: RE: greetings and a question!
  • Next by Date: Re: Re: Optimizing fixed point iteration
  • Previous by thread: Re: Can't abort a loop with Print inside (V6)
  • Next by thread: Re: Re: Re: Can't abort a loop with Print inside (V6)