[chuck-users] feature request: including files

Ge Wang gewang at CS.Princeton.EDU
Wed Oct 19 18:14:40 EDT 2005


> 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");

This works, except that machine.add() only adds the file after you've 
executed the code, which means you can't yet use the 'x' class in the same 
file.  however, you should be able to do so in subsequent files.  So:

     %> chuck TheClass.ck [other files that use TheClass]

     or

     %> chuck Loader.ck [other files that use files loaded in Loader.ck]

And of course you can add classes and files that use them with on-the-fly 
commands:

terminal 1:

     %> chuck --loop

terminal 2:

     %> chuck + TheClass.ck
     %> chuck + ClientCode.ck


We are still working on the include problem.  Using explicit (precessor) 
includes can be problematic - since there are no separate headers, mutual 
usage is precluded, and there are other complications too, such as cycles 
and uh...

The current ChucK framework is moving towards a system similiar, but 
not identical, to Java (scan, automatically search/load by class/filename) 
and even matlab (yay?).  This is a high priority but may take a while to 
converge on a useful resolution.  I hope we will continue thinking and 
posting on this...

Best,
Ge!


More information about the chuck-users mailing list