[PD-dev] [ pure-data-Bugs-1776891 ] [until] hangs if started with a negative number

SourceForge.net noreply at sourceforge.net
Mon Sep 17 15:05:56 CEST 2007


Bugs item #1776891, was opened at 2007-08-18 16:03
Message generated for change (Comment added) made by zmoelnig
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1776891&group_id=55736

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: 2
Private: No
Submitted By: Matteo Sisti Sette (sistisette)
>Assigned to: Miller Puckette (millerpuckette)
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]

----------------------------------------------------------------------

>Comment By: IOhannes m zmölnig (zmoelnig)
Date: 2007-09-17 15: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=478070&aid=1776891&group_id=55736




More information about the Pd-dev mailing list