Hello, everybody: I've been looking at Michael Heuer's (most excellent) LiCK library. He uses an idiom that I don't see documented: intervals.get(i) $ Interval @=> Interval interval; from Arpeggiator.ck, line 35 https://github.com/heuermh/lick/blob/master/Arpeggiator.ck What does $ do? Of course just because I don't see it in the documentation doesn't mean it's not there, so please feel free to point me to the docs if I've overlooked it. Thanks! Greg
Hello Greg,
$ is the cast operator, documented here
http://chuck.cs.princeton.edu/doc/language/oper.html
In the example you have posted, the specific class of reference.get(i)
is not known, so it must be cast to Interval. This is a pattern
similar to how collections in java were used before generic types were
added to the language.
michael
On Thu, Nov 21, 2013 at 11:29 AM, Gregorio Gomez
Hello, everybody:
I've been looking at Michael Heuer's (most excellent) LiCK library. He uses an idiom that I don't see documented:
intervals.get(i) $ Interval @=> Interval interval;
from Arpeggiator.ck, line 35 https://github.com/heuermh/lick/blob/master/Arpeggiator.ck
What does $ do?
Of course just because I don't see it in the documentation doesn't mean it's not there, so please feel free to point me to the docs if I've overlooked it.
Thanks! Greg
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
Hi, Michael:
Ah! Ok, thanks!
Greg
-----Original Message-----
From: Michael Heuer [mailto:heuermh@gmail.com]
Sent: Thursday, November 21, 2013 10:39
To: ChucK Users Mailing List
Subject: Re: [chuck-users] What does $ do?
Hello Greg,
$ is the cast operator, documented here
http://chuck.cs.princeton.edu/doc/language/oper.html
In the example you have posted, the specific class of reference.get(i) is not known, so it must be cast to Interval. This is a pattern similar to how collections in java were used before generic types were added to the language.
michael
On Thu, Nov 21, 2013 at 11:29 AM, Gregorio Gomez
Hello, everybody:
I've been looking at Michael Heuer's (most excellent) LiCK library. He uses an idiom that I don't see documented:
intervals.get(i) $ Interval @=> Interval interval;
from Arpeggiator.ck, line 35 https://github.com/heuermh/lick/blob/master/Arpeggiator.ck
What does $ do?
Of course just because I don't see it in the documentation doesn't mean it's not there, so please feel free to point me to the docs if I've overlooked it.
Thanks! Greg
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
participants (2)
-
Gregorio Gomez
-
Michael Heuer