Re: Re: Re: Can't abort a loop with Print inside (V6)
- To: mathgroup at smc.vnet.net
- Subject: [mg83146] Re: [mg83119] Re: [mg83089] Re: Can't abort a loop with Print inside (V6)
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Tue, 13 Nov 2007 03:34:50 -0500 (EST)
- References: <200711100842.DAA00815@smc.vnet.net> <2230479.1194878974881.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
The KERNEL is finished with the loop before you can abort it; the
front-end is still busy with outputs.
Even so, I think the outputs should stop as well.
Bobby
On Mon, 12 Nov 2007 04:09:27 -0600, Bo Hu <bhu at cvs.rochester.edu> wrote:
> 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
>>
>
>
>
--
DrMajorBob at bigfoot.com
- References:
- Re: Can't abort a loop with Print inside (V6)
- From: Bill Rowe <readnewsciv@sbcglobal.net>
- Re: Can't abort a loop with Print inside (V6)