[chuck-users] fun dur GetT() rises to invalid type
Spencer Salazar
ssalazar at princeton.edu
Thu Dec 15 20:59:56 EST 2005
it seems that the :: operator has precedence over the . operator (or
they have the same precedence and are evaluated left to right), so
noteDuration::myInstrument.GetT()
is being interpreted as
((noteDuration::myInstrument).GetT())
Thus the compiler is trying and failing to interpret myInstrument as
a dur type. it seems the desired behavior in your case is for the
expression to be interpreted as
(noteDuration::(myInstrument.GetT()))
Parentheses should fix up the problem. this compiles fine and
produces what i think is the behavior you desire:
noteDuration::(myInstrument.GetT()) => now;
spencer
On Dec 15, 2005, at 8:42 PM, eduard wrote:
> Hi there,
>
> I have a osc meta-instrument wich has a function to get the
> unit_time to advance. Something like:
>
> public class oscInstrument
> {
> // some members here
> // ....
> fun dur GetT(){ return T_};
> }
>
> It compiles fine, but when used in the following manner:
>
> oscInstrument myInstrument;
> while(true)
> {
> //do_something
> //...
> noteDuration::myInstrument.GetT() => now
> }
>
> it rises the following error: invalid type 'oscInstrument' in
> postfix of dur expression... (must be of type 'dur') .
>
> However if I do the following:
>
> dur T;
>
> while(true)
> {
> //do_something
> myInstrument.GetT() => T;
> noteDuration::T=> now
> }
>
> everything works fine.
>
> Any ideas?
>
>
> Thanks,
>
> Eduard
> _______________________________________________
> 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