[chuck-users] cast dur to time?

Kassen signal.automatique at gmail.com
Mon Jan 7 13:50:46 EST 2008

On 07/01/2008, mike clemow <gelfmuse at gmail.com> wrote:
> Kassen,
> 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 see where you are coming from, but "now" really is a duration already, in
a way.

<<<now /minute>>>; is quite legal and will return a float expressing the
amount of minutes the VM has been alive. I see "now" and other times as a
duration with the start of the VM as it's start.

So; we can divide "now" by a duration and get a float but a float times a
duration will always be a "duration" and not a "time", so far, in practice.

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;

A keyword for this may not be enough. The following is a attempt to create
my own "birth" keyword expressing this. I can't get it smaller then this and
I would say this is quite perverse in a way;

 //strongly typed meets strongly timed :¬p
//at least it runs and works....
now - ((now /samp)::samp) => time birth;

I'd say this means casting can make sense but I'm open to ideas.

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.

Maybe you'll like my attempt above too.... well, I think it works....

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

More information about the chuck-users mailing list