[chuck-users] cast dur to time?

mike clemow gelfmuse at gmail.com
Mon Jan 7 12:14:59 EST 2008


That actually doesn't make sense to me.  2::second has no reference point to
when it started or when it ends.  It's just 2 seconds of duration.  So, for
me, this:

2::second $ time => time later;

seems so implicit that it's ambiguous.  I would, however, agree that there
ought to be a (dare I say) keyword for the time at which the VM started so
that you could basically do the same thing that you did in the first line.

vmstart + 2::second => time afterVmStarted;

Of course, you could just approximate this functionality by having this line
run the moment the vm starts:

now => time vmstart;

Then, you'd be able to the do everything relative to that time.  At least,
that's how I would solve it.


On Jan 7, 2008 10:11 AM, Kassen <signal.automatique at gmail.com> wrote:

> Dear list (and language designers in particular),
> this is legal;
> now + 2::second => time later;
> so, we know that time and duration are quite similar things (we already
> knew that ourselves but now we know ChucK agrees).
> However, this isn't legal;
> 2::second $ time => time later;
> I tried this, intending "later" to refer to the moment 2 seconds after the
> VM sprang to life.
> Are there good reasons not to allow the casting from time to dur and dur
> to time?
> Yours,
> Kas.
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20080107/86d525aa/attachment.htm 

More information about the chuck-users mailing list