On 10/16/07, Martin Ahnelöv wrote:
Since it's a public class, multiple shreds can access it. However, I
don't really have an idea about how you do that. Please, kassen!
Explain!
From then on, any chuck code that runs in that VM can instantiate objects of
Well, you just execute the file that contains the public class in a VM.
that class.
example;
-----------B.ck----------------------
Foo bar;
<<>>;
--------------------------------------
-----------A.ck-------------------
public class Foo
{
23 => int value;
}
--------------------------
now B is only going to compile if you run A (and thus define Foo) first. Not
very hard, I'd say.
Also, no, currently chuck doesn't have a way to import libraries
True. If B.ck would read;
-------B.ck-----------------------
Macine.add("A.ck");
Foo bar;
<<>>;
--------------------------------
It wouldn't work as B would be parsed (finding a undefined class) before A
would be Machine.added. So; one possible solution to this would be a
Machine.include() command that would see whether the classes in it's
argument are already defined, if not define those and only then parse the
rest of the file. That's not without problems as a way of fixing the issue
though and if available I'd support a more intelligent method.
Also, once added a public class can't be edited, for example to add some
feature to it, without restarting the whole VM.
Kas.