Hello all, I was wondering if there is a way to create a global function that could be shared by many public classes? I had been working with some functions that were NOT in a class, but once I changed the class to public, those functions were no longer accessible, even though they were in the same file. Mike
Hey Mike, The public keyword is tied to classes right now. You could try using the static keyword. For now the use of the static and public keywords are a little iffy. Let us know how the experiments go. --art On 2-Mar-06, at 10:02 AM, Mike McGonagle wrote:
Hello all,
I was wondering if there is a way to create a global function that could be shared by many public classes? I had been working with some functions that were NOT in a class, but once I changed the class to public, those functions were no longer accessible, even though they were in the same file.
Mike _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
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.ht... Best, Ge!
participants (3)
-
Adam Tindale
-
Ge Wang
-
Mike McGonagle