[chuck-users] adding a chuck class from an external file

Martin Ahnelöv operagasten at gmail.com
Wed Nov 7 04:21:52 EST 2007


tis 2007-11-06 klockan 18:56 -0800 skrev Juan-Pablo Caceres:
> Hello,
> 
> Doing some research on how to add a class that is defined in an external 
> file I came across an email Ge sent explaining this wasn't possible yet:
> 
> https://lists.cs.princeton.edu/pipermail/chuck-users/2006-March/000440.html
> =====================================================================
> foo.ck
> ---
> public class Foo
> { /* stuff */ }
> ---
> 
> bar.ck
> ---
> machine.add( "foo.ck" );
> Foo foo;  // this won't pass the type checker
> ---
> 
> running bar.ck first (the intended usage) would result in a type
> checker error 'unknown class Foo', since foo.ck won't be added until
> runtime and so 'Foo' is unknown when bar.ck is compiled.
> =====================================================================
> 
> I remember though him also saying that the way to add external functions 
> (functions defined in an external file) was to create a classes that 
> contains them.
> 
> So is there any new way to add a class defined in an external class? 
> Your help is greatly appreciated.

Try sporking the file with the public class to the VM first, and then
sporking the file that uses the class. that should work.

Hope that helps,
Gasten



More information about the chuck-users mailing list