Thanks for the reply, Perry. This is indeed what I've taken to doing.

In the GameTrak wrappers I've written I have public classes for Tether, GameTrak, Button, etc, that all extend Event. The abstractions are useful, but it means any script that uses them has to list them in the include.ck, and in the correct order, even if the top-level GameTrak is all that is referenced:
Machine.add("external/gametrak/button.ck");
Machine.add("external/gametrak/point.ck");
Machine.add("external/gametrak/tether.ck");
Machine.add("external/gametrak/gametrak.ck");

I'd like to have each ck file declare its imports so users don't have to know about these internals. Maybe there's a similar way to do this that I'm not seeing yet.


On Sun, Aug 16, 2020 at 7:13 PM Perry Cook <prc@cs.princeton.edu> wrote:
So if I understand you correctly, this is solved fairly easily by a structure we propose in the "ChucK Book”

1)  Create a file that loads (by Machine.add()) all the classes you think you’ll need.

2)  As the last line of that, have it Machine.add() a different file, which then
either does the work, or adds any file(s) that depend on those initial classes.

I’ve sometimes even named these files include.ck and Main.ck
but include also runs Main, so it’s not strictly an “include” or import.

Hope this helps,

PRC

_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users