Patches item #1776891, was opened at 2007-08-18 07:03 Message generated for change (Comment added) made by millerpuckette You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478072&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: None Status: Open Resolution: None Priority: 2 Private: No Submitted By: Matteo Sisti Sette (sistisette) Assigned to: Miller Puckette (millerpuckette) Summary: BUG; [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]
----------------------------------------------------------------------
Comment By: Miller Puckette (millerpuckette)
Date: 2007-12-17 09:04
Message: Logged In: YES user_id=313747 Originator: NO
I think I prefer to silently replace teh negative number by zero... that's more in keeping with the way Pd usually reacts for out- of-range numerical args. Should be fixed in upcoming commit.
----------------------------------------------------------------------
Comment By: IOhannes m zmölnig (zmoelnig) Date: 2007-09-17 06:05
Message: Logged In: YES user_id=564396 Originator: NO
obviously the fix is trivial, i have attached a unified diff that reports an error for negative values and refuses to perform. File Added: until_negative.diff
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1776891...