Often a single class will compose several different aspects of functionality.
For example, the LiCK class Sample can be used with several other APIs in the LiCK library. It has its own direct API (play() method) and it also implements several of the LiCK functor interfaces (Procedure run(), IntProcedure run(int), IntIntProcedure run(int, int), FloatProcedure run(float), and FloatFloatProcedure run(float, float)).
In Java and other object-oriented languages, class Sample could implement all of these interfaces
public class Sample
implements Procedure, IntProcedure,
IntIntProcedure, FloatProcedure, FloatFloatProcedure
{
//...
}
ChucK does not provide interfaces, only classes. This would also be possible with multiple class inheritance, but ChucK does not provide that either. Thus Sample must be implemented with the hack as described here
Often a single class will compose several different aspects of functionality.
For example, the LiCK class Sample can be used with several other APIs in the LiCK library. It has its own direct API (
play()
method) and it also implements several of the LiCK functor interfaces (Procedurerun()
, IntProcedurerun(int)
, IntIntProcedurerun(int, int)
, FloatProcedurerun(float)
, and FloatFloatProcedurerun(float, float)
).In Java and other object-oriented languages, class Sample could implement all of these interfaces
ChucK does not provide interfaces, only classes. This would also be possible with multiple class inheritance, but ChucK does not provide that either. Thus Sample must be implemented with the hack as described here
Sample.ck, line 97 https://github.com/heuermh/lick/blob/master/Sample.ck#L97
and then callers must use one of the
asXXX()
methods instead of relying on the type systemeuclidMidiTr808.ck, line 28 https://github.com/heuermh/lick/blob/master/examples/euclidOscTr808.ck#L28