[chuck-users] Hello, some newbie questions

Michael Heuer heuermh at gmail.com
Tue Oct 5 14:09:35 EDT 2010


Mat Schaffer:

>> No, you have to determine the dependencies and dependency order by
>> hand.  This is my number one feature request, to have a proper
>> namespace and import mechanism.
>
> Any idea if this is getting worked on? It seems like ChucK development is a
> little slow judging from the dev mailing list traffic.

I don't know.


>> Only public classes are shared.  You can add static fields & methods
>> to public classes.
>
> Where's the deference for how to define static fields? Can you have static
> methods too? That might be good enough.
>
>> > - Is there a way to pass functions as arguments to another function or
>> > return a function? Also, are fun's proper closures or am I just getting
>> > lucky? I was thinking maybe I could use functional style programming to
>> > build things like arpeggiations. If this is totally overkill let me know
>> > :)
>>
>> No.  As you may have seen, LiCK uses functors to approximate function
>> arguments/closures.  Feature request #2.  :)
>
> Yeah, is there an example somewhere on how to use those? The `Object @
> default` makes no sense to me :)

http://github.com/heuermh/lick/blob/master/Loops.ck

has static fields and methods, and uses Procedure to build composite loops

class Kick extends Procedure {
  fun void run() { // make kick sound }
}
class Snare extends Procedure {
  fun void run() { // make snare sound }
}
Kick kick;
Snare snare;
Loops.append(Loops.append(kick, 200::ms), Loops.append(snare,
200::ms))) @=> Procedure beat;
Loops.loop(beat, 2) @=> Procedure measure;
Loops.loop(measure, 4) @=> Procedure verse;
Loops.append(verse, Loops.append(verse, Loops.append(chorus,
Loops.append(verse, chorus)))) @=> Procedure song;
song.run();

But yeah the syntax is icky.

   michael


More information about the chuck-users mailing list