[chuck-users] imports/includes (Curtis Ullerich)

Curtis Ullerich curtullerich at gmail.com
Sun Aug 16 22:33:40 EDT 2020


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

In the GameTrak wrappers
<https://github.com/curtisullerich/computer-music/tree/master/chuck/gametrak>
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 at 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 at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200816/2b5be307/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Listing9.17.ClassLoading.jpeg
Type: image/jpeg
Size: 25372 bytes
Desc: not available
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20200816/2b5be307/attachment-0001.jpeg>


More information about the chuck-users mailing list