[chuck-users] feature request: including files

Adam R. Tindale adamtindale at hotmail.com
Wed Oct 19 03:26:38 EDT 2005


Hi Graham,
>
> For example, I could have a bunch of functions which I could then
> include in other projects.  You can't machine.add a
> fun float changevalue ( float foo )
> { ...
> return bar; }
>
No, but you can make a public class that has these functions in it.

public class x{

fun float changeval(float foo){return bar;}

}//eof

machine.add("myclass.ck");

x instanceOfX;

instanceOfX.changeval( yourGreatData );

..

This works quite well. Then you can make a file like classloader.ck 
that is just a bunch of machine.add() and when you write a new class 
you drop it into the classloader.ck file and you always have your handy 
dandy classes ready to go.

--art




More information about the chuck-users mailing list