On 8/18/10 at 7:07 AM, tmatsoukas at me.com (Themis Matsoukas) wrote:
>I was hoping someone would answer your question because I too find
>'Abort Evaluation' to work erratically. For example, the loop below
>responds to 'Abort Evaluation':
>i = 1; While[i <= Infinity, ++i]
>..but this loop does not:
>i = 1; While[i < 1000, Print[i]; ++i]
I would have expected things to be just the other way around but
wouldn't have thought to try either of these if there was a
difference. But deliberately creating a loop that doesn't
respond to Abort Evaluation isn't really something I want to do.
But you post does make me wonder why things behave this way.
Perhaps there is some level of error trapping present. It would
be easy for a syntax checker to see a test checking a loop
counter to be less than infinity will always be true. Suppose
the first test were changed to
i = 1; While[i < 1000, i--]
It would still be an infinite loop but not so obvious as
comparing i and infinity. Perhaps, this change makes a
difference in the response to Abort Evaluation. And do note, I
am speculating here rather than testing this.