<div dir="ltr">Michael,<div><br></div><div><a href="http://import.ck">import.ck</a> is where I saw Machine.Add() used to import. The structure of LicK showed me the current paradigm for organizing a large code base in ChucK. Thanks.<div>

<br></div><div>Namespaces would be great. They should be nested of course. I wouldn't think they would be too difficult to add. The basic framework for namespaces (at least for variable names) clearly already exists. The proof of that is that different files already have different namespaces. Some level of import functionality exists as well as a side effect of MachineAdd() as <a href="http://import.ck">import.ck</a> demonstrates. It sounds like it is just a matter of factoring those code fragments out of the Add() method and generalizing them a little.<div>

<br></div></div><div>Personally I have no objection to using Machine.Add() as the standard import methodology now that I know it is there. It is sort of strange making the functionality part of the VM. It would be more natural to make import a language feature but as long as the functionality exists that's the important part. I imagine that language enhancements add a whole different level of development and test complexity.</div>

<div><br></div></div><div>-steve</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 28, 2013 at 11:16 AM, Michael Heuer <span dir="ltr"><<a href="mailto:heuermh@gmail.com" target="_blank">heuermh@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Steve, welcome to ChucK!<br>
<br>
LiCK is implemented with one public ChucK class (and zero or more<br>
non-public classes) per .ck file and a bunch of Machine.add()<br>
statements in one .ck file (<a href="http://import.ck" target="_blank">import.ck</a>).  It ain't pretty but it works.<br>
<br>
One of my top outstanding ChucK language feature requests is to add<br>
namespaces and import statements so that library/shared code can be<br>
made modular.<br>
<br>
I thought I saw somewhere hidden in new features (probably related to<br>
Chugins) that there is a magick library directory where one can place<br>
.ck files and have them loaded at startup.  Might this be a workaround<br>
for having to use the <a href="http://import.ck" target="_blank">import.ck</a> file explicitly?<br>
<br>
   michael<br>
<br>
<br>
On Mon, Oct 28, 2013 at 3:03 AM, Steve Morris <<a href="mailto:barbershopsteve@gmail.com">barbershopsteve@gmail.com</a>> wrote:<br>
> Another question. I finally found the scope documentation in the shred page<br>
> (obviously not my first guess or this thread wouldn't exist) where I also<br>
> found machine.add() which together start to fill major holes in my<br>
> understanding. From Lick documentation I deduce that machine.add() does more<br>
> than simply create a shred. It is also a way of including various<br>
> declarations and making them available to other shreds. (Note: That is such<br>
> fundamental functionality that it is probably worth stating explicitly<br>
> someplace in the ChucK documentation even if it is "just" a side effect of<br>
> sporking.)<br>
><br>
> However:<br>
><br>
> inter-shred communication<br>
><br>
> Shreds sporked in the same file can share the same global variables. They<br>
> can use time and events to synchronize to each other. (see events) Shreds<br>
> sporked from different files can share data (including events). For now,<br>
> this is done through a public class with static data (see classes). Static<br>
> data is not completely implemented! We will fix this very soon!"<br>
><br>
> This sounds ominous. Should I worry about what part of static data is not<br>
> implemented? Are there restrictions to static data I should be wary of.<br>
><br>
><br>
><br>
><br>
> On Mon, Oct 28, 2013 at 3:24 AM, Steve Morris <<a href="mailto:barbershopsteve@gmail.com">barbershopsteve@gmail.com</a>><br>
> wrote:<br>
>><br>
>> Thank you Spencer. That's very helpful. I haven't looked at Bitcrusher yet<br>
>> but besides being chuck full ;-) of useful toys Lick is also a goldmine of<br>
>> interesting programming examples. I really learn best by reading code. Lick<br>
>> should keep me busy for a while.<br>
>><br>
>> -steve<br>
>> aka zencuke<br>
>><br>
>><br>
>><br>
>><br>
>> On Sun, Oct 27, 2013 at 10:47 PM, Spencer Salazar<br>
>> <<a href="mailto:spencer@ccrma.stanford.edu">spencer@ccrma.stanford.edu</a>> wrote:<br>
>>><br>
>>> Hi Steve,<br>
>>><br>
>>> 1. The scope of variables is more or less standard Java/C-like --<br>
>>> variables can be used anywhere in the scope in which they are declared or<br>
>>> scopes enclosed within, and the underlying values can be passed around to<br>
>>> other scopes. File-scope variables can be accessed in pretty much any shred<br>
>>> created in that file. Sharing variables across files tends to be more<br>
>>> complicated -- the basic paradigm is to make a public class and access<br>
>>> static variables or methods within that.<br>
>>><br>
>>> 2. Michael Heuer's LicK is one example of this:<br>
>>> <a href="https://github.com/heuermh/lick" target="_blank">https://github.com/heuermh/lick</a><br>
>>><br>
>>> 3. Depending on what your C++ code is doing, you could use a chugin<br>
>>> (ChucK plugin). These are generally most appropriate for unit generators and<br>
>>> relatively simple generic library functionality. One simple example,<br>
>>> Bitcrusher:<br>
>>> <a href="https://github.com/ccrma/chugins/tree/master/Bitcrusher" target="_blank">https://github.com/ccrma/chugins/tree/master/Bitcrusher</a><br>
>>><br>
>>> 4. The installer should also have installed the command line executable<br>
>>> -- you can check this by opening up a window in Terminal and entering a<br>
>>> chuck command:<br>
>>> $ chuck --version<br>
>>><br>
>>> chuck version: 1.3.2.0 (chimera)<br>
>>>    mac os x : intel : 64-bit<br>
>>>    <a href="http://chuck.cs.princeton.edu/" target="_blank">http://chuck.cs.princeton.edu/</a><br>
>>>    <a href="http://chuck.stanford.edu/" target="_blank">http://chuck.stanford.edu/</a><br>
>>><br>
>>> $ chuck --help<br>
>>> ...<br>
>>> $ chuck path/to/<a href="http://file.ck" target="_blank">file.ck</a><br>
>>> etc.<br>
>>><br>
>>> spencer<br>
>>><br>
>>><br>
>>><br>
>>> On Fri, Oct 25, 2013 at 4:20 PM, Steve Morris <<a href="mailto:steve@judgement.com">steve@judgement.com</a>><br>
>>> wrote:<br>
>>>><br>
>>>> I'm new to ChucK but am very excited. I have grand plans. I will likely<br>
>>>> have lots of questions (some unfortunately stupid, apologies in advance)<br>
>>>> although I have been pouring through manuals, examples, the wiki, git source<br>
>>>> code and forum archives. Hopefully my questions won't be too annoying. I'm<br>
>>>> always happy to receive answers in the form of pointers to documentation I<br>
>>>> should be reading before wasting the groups time. Here's my first pass.<br>
>>>><br>
>>>> 1) I can't find any thing that documents the scope of variables and<br>
>>>> objects. Can I create variables that can be accessed in other files, other<br>
>>>> threads.<br>
>>>><br>
>>>> 2) My first project will be fairly large hopefully split between many<br>
>>>> files. Where can I look to see how ChucK code should be broken down and<br>
>>>> organized. What is a good paradigm for a shared library.<br>
>>>><br>
>>>> 3) Speaking of libraries I would like to bring a lot of existing C++<br>
>>>> code into my project. Does dynamic linking actually work. I see vague (old)<br>
>>>> references to it being made to work again as if it was broken and other<br>
>>>> references to it just needing documentation which will come "soon." Lacking<br>
>>>> documentation is there an example library that does it. I can get a long<br>
>>>> ways with a working example. Working code may be confusing and slow to<br>
>>>> understand but it is its own most accurate documentation. I've looked at<br>
>>>> chuck_dll and I think I need to see the interface from the other side to<br>
>>>> really understand. I'm happy to be a reviewer for "preliminary" draft<br>
>>>> documentation.<br>
>>>><br>
>>>> 4) The Mac install seems to have installed a single bundled app. How do<br>
>>>> I use the command line interface?<br>
>>>><br>
>>>> Thanks,<br>
>>>><br>
>>>> -steve (aka zencuke)<br>
>>>><br>
>>>><br>
>>>> _______________________________________________<br>
>>>> chuck-users mailing list<br>
>>>> <a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
>>>> <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
>>>><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> chuck-users mailing list<br>
>>> <a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
>>> <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
>>><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> chuck-users mailing list<br>
> <a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
> <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
><br>
_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
</blockquote></div><br></div>