Bugs item #1776891, was opened at 2007-08-18 16:03 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1776891...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: puredata Group: v0.40.2 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Matteo Sisti Sette (sistisette) Assigned to: Nobody/Anonymous (nobody) Summary: [until] hangs if started with a negative number
Initial Comment: If you send a negative number to an [until] object, it behaves as if you sent it a bang: i.e., it iterates an infinite number of times (unless a bang is received in the right inlet stopping the iterations).
Instead, it should either treat a negative number as zero, or generate an error message when it receive a negative number.
The documentation (i.e. help patch) says:
"If you start "until" with a number, it iterates at most that number of times".
Though "iterating at most -21 times" means nothing strictly speaking, it would make much more sense if it didn't iterate at all. Also, it would be a warranty that sending it a number would never ever cause an infinite loop.
You may argue that sending [until] a [-21( is like writing: for (int i=0; i<-21; i++) which produces an infinite loop.
However, that's not the way [until] is described in the documentation. No initialization, testing condition and increment are mentioned. So it should rather be compared to languages where a for loop looks like: for i = M to N In such languages, using M>N *usually* produces either a decrementing i or no iteration at all.
Finally, if one actually does want an infinite loop (obviously taking care of using the right inlet to stop it) s/he can do it with a [bang( message.
Obviously this is a minor issue, as one can always put a [max 0] before [until]
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1776891...