Closed microbit-carlos closed 1 year ago
Should we implicitly add an infinite loop if there are scheduled functions?
I don't think we should. The user code may sleep for a finite time (eg 5 seconds) and so they would get confused if after that it also slept forever.
Also, the user may add an infinite loop themselves, and then expect ctrl-C to stop that loop and drop to the REPL. They would be surprised to find out they need to use ctrl-C twice to get to the REPL.
Agreed, all good reasons not to implement this 👍
If we have a simple programme like this, the scheduled
log_temp
function never runs, as the programme ends:So we need to add a busy infinite loop to ensure the programme continues running forever:
Should we implicitly add an infinite loop if there are scheduled functions? The answer might be "no", but it's worth considering. Assuming Ctrl+C stops everything (which I believe it does), would there be any disadvantage to having that?