[chuck-users] Globally shared functions

Ge Wang gewang at CS.Princeton.EDU
Thu Mar 2 18:15:16 EST 2006


Hi!

>> I was wondering if there is a way to create a global function that
>> could be shared by many public classes?

Here is an example:

in X.ck
---

   // class
   public class X
   {
       fun static void foo()
       { <<< "foo!" >>>; }
   }

   // invoke X.foo()
   X.foo();


from Y.ck
---

   // invoke X.foo()
   X.foo();

---

The only trick, until we make better include/auto-loading, is to run
X.ck before any shreds that needs X.foo(), like:

     > chuck X Y

Also, we need to really fix the access modifiers 'public' and things,
which is on the agenda.

To share data globally, see:

https://lists.cs.princeton.edu/pipermail/chuck-users/2005-November/000165.html

Best,
Ge!



More information about the chuck-users mailing list