<div dir="ltr">2008/7/24 Stephen Sinclair &lt;<a href="mailto:radarsat1@gmail.com">radarsat1@gmail.com</a>&gt;:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><br></div>I *was* kind of curious how you came up with this case.. ;-)<br>
</blockquote><div><br>:¬) I&#39;d explain more but it&#39;s a part of a interface revision of a 2500 or so line file so that would quickly get complicated and require a lot of explaining.... Of course anything that would run into this can also be re-written.<br>
<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
I wonder if it wouldn&#39;t be better to have the compile issue an error<br>
on something like if(second), since I don&#39;t see how it&#39;s very useful<br>
and could lead to bad logic on the part of the user. </blockquote><div><br>Well, it&#39;s convenient for things like this;<br><br>while (beat =&gt; now)<br>&nbsp; {<br>&nbsp; my_drum(boom);<br>&nbsp; }<br><br>...which is arguably bad form but very pleasant to write. I forgot who came up with it but it&#39;s popular in the &quot;one line ChucK crazy&quot; game on the forum.<br>
<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">&nbsp;if(!now) could<br>
be useful for doing something only when the VM first starts up,<br>
however I generally think that basing your scripts on absolute time<br>
(relative to start of VM) is probably bad practice. &nbsp;Not to mention<br>
that if(!now), while nice and compact, is not the most readable way to<br>
express that logic.</blockquote><div><br>It&#39;s also invalid because &quot;now&quot; is not a integer and you can only do &quot;not&quot; on integers. If you want that you will have to go;<br><br>if ( !((now / samp) $&nbsp; int) ) &lt;&lt;&lt;&quot;yay&quot;&gt;&gt;&gt;;<br>
<br>First the division creates a float, we cast that to integer and this int can be inverted logically. That is, BTW, a issue with inversion, not with evaluating if clauses as such. I use that sort of thing too toggle Gain&#39;s used as routing gates;<br>
<br>Gain g;<br><br>//toggle<br>!( g.gain() $ int) =&gt; g.gain;<br><br>Ok, well, maybe it&#39;s a similar kind of case...&nbsp; after all. Perhaps &quot;!&quot; simply should return &quot;1&quot; for non-zero inputs.<br><br>Beware, BTW, that the above examples aren&#39;t without danger because you can have rounding errors casting to int. I think casting to int will always round towards 0.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
On second though, if(dur) could have some uses, I guess. &nbsp;Not sure.<br>
Perhaps in calculating a delay length, while trying to avoid<br>
zero-delay feedback.<br>
<div></div></blockquote><div><br>There I&#39;s use;<br><br>if (delay &gt; 0::ms) <br></div></div><br>Because of the dengers of negative delay.<br><br>While going over Ge&#39;s paper, BTW, I sugested that we could perhaps use &quot;unless&quot; as a miror of &quot;if&quot; since we already have &quot;while&quot; and &quot;untill&quot; which are also mirror.images. I intended this as fun syntactic sugar (like &quot;untill&quot; already is) but now that I think of it; that would nicely get around logic inversion of time and dur type variables in many cases.<br>
<br>Interesting discussion; once more it&#39;s more complicated then I realised at first.<br><br>Yours,<br>Kas.<br></div>