[chuck-users] cast dur to time?

mike clemow gelfmuse at gmail.com
Tue Jan 8 14:25:55 EST 2008

Okay...  affine spaces.  I'm going to have to wikipedia that one, i'm
afraid (high school math ain't doin' it for me here ;-)  I understand
the analogy of vectors and point, though--I think that lends some
credence to the idea that Chuck is already on the right path as far
how the dur and time types work.

I still have a few questions.  The first is for Kassen:  Why do you
want to know the VM start time?  (Just curious)  Although, I don't
like the idea of dur -> time casting, I don't see why the following
isn't legal:

0.0 $ time => time zero;

Also, if we have a special keyword for the birth of the VM, on the
precedent of how "now" currently works, does that mean that
subtracting duration from "birth" would be equivalent to adding
duration to "now?"  Does that add anything, or just confuse things

1::second => now;  // equivalent to 1::second +=> now; as Kassen reminded us


1::second -=> birth;   // same thing, effectively???

I'm just thinking out loud...


On Jan 8, 2008 10:35 AM, pibsid at suomi24.fi <pibsid at suomi24.fi> wrote:
> Mike wrote:
> >>Still, this would be sugar.
> >>I really like the argument that if (time / duration = float) is legal, then (time / float = duration) should also be legal, however, it also follows that (time = duration * float), which I don't like. (2::second * 4) ought to return 8::second. So, I think that we're dealing with concepts here that don't fit squarely into the model of mathematics. After all, we don't multiply strings and floats, do we?
> >>I'm all for a more rigorous understanding of these types, though. This is all very confusing.
> >>-Mike
> What I think we're dealing with here mathematically is affine spaces.
> In an affine space you have points and vectors that connect them. The difference between a regular vector space is that there is no "true" origo but everything is relative. Also the operations on points differ from operations with vectors.
> Here the big letters denote points in an affine space and small letters denote vectors:
> -For each two points A and B we have an unambigious vector ab that connects them.
> -For each three points A, B and C: ac = ab + bc
> Operations:
> A - B = x
> A + x = B
> But:
> A + B = (undefined), (How do you add points together? Makes no sense)
> And thus A*(scalar) = (undefined), (In a vector space all this would be legal)
> Compare to time:
> time - time = dur;
> time + dur = time;
> time + time = (undefined)
> time*float = (undefined)
> The point (no pun intended) with affine spaces is that you can only make new points if you already have at least one to begin with. You can't just throw in a point if you don't define how it relates to the points already present.
> For the syntax issues I see no harm in adding
> me.bith = the time since the VM's start that the shred was sporked.
> To me it's just not a big deal to type: now => time birth; At the beginning of a sporkable funtion.
> But hey. We all find different things intuitive or counter-intuitive.
> Cheers
> -Pyry
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users


More information about the chuck-users mailing list