[chuck-users] good until loop

Kassen signal.automatique at gmail.com
Tue Sep 28 07:48:21 EDT 2010


On 28 September 2010 00:27, Daniel Trueman <dtrueman at princeton.edu> wrote:

> i just wish you could do until an Event... of course, there are other
> ways...
>
>
There is of course the option to extend Event, to also hold a truth value.
What this won't do is set the value as .send() or .broadcast() is called,
but we can make our own .transmit() that would set the value as well as call
.send() or .broadcast().

I find Event nearly always needs to be extended or encapsulated, but that's
fine; it's about as versatile as Envelope and about as useful on it's own.

To return for a moment to truth values as well; time and duration type
variables or constants will evaluate to "true" when they are non-zero. This
means that "if(now)" is a useful way of checking whether the VM is currently
starting. However; && and || aren't overloaded to deal with this kind of
stuff, only the "top level" evaluations like "if", "while" and "until" are.
I still hold that to be a inconsistency that needs some care.

Nothing new here but I thought I'd go over the useful tricks and trivia,
Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20100928/e3ccd9f2/attachment.html>


More information about the chuck-users mailing list