[chuck-users] cross-referenced classes?

Kassen signal.automatique at gmail.com
Fri Mar 13 14:07:49 EDT 2009


Rob;

How absolute the knave is!  We must speak by the card, or equivocation will
> undo us!
>

I don't know, equivocation may well still undo us...


>
> Thanks.
>

That's ok, I had good fun. Cleaner would likely be defining a class
"proto_engine" and one "proto_controller", adding those, then extending
both, this avoids needing a rather clumsy class that has some members of
both Engine and Conttroller; that's bound to lead to confusion later on.

It turns out you are right, BTW and that you can create references to
classes without instantiating them, from there on you can only use static
members of those;

class Foo
    {
    static int bar;

    fun static void printA() {<<<"bang">>>;}
    fun  void printB() {<<<"bang">>>;}
    }

Foo @ baz;
<<<baz.bar>>>;
baz.printA();

//this creates a nullpointer
baz.printB();

Could get useful, I suppose, but I don't anticipate I'll use this a lot.

Kas.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20090313/dbcfd5af/attachment.html>


More information about the chuck-users mailing list