electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » ChucK programming language
Public class already declared in namespace... help!
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [5 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
alexbarbed



Joined: Apr 09, 2011
Posts: 14
Location: UK

PostPosted: Sat Apr 16, 2011 10:03 am    Post subject: Public class already declared in namespace... help! Reply with quote  Mark this post and the followings unread

Hi

As I understand it, in order to share data between shreds, I need to first declare them as static variables in a public class. This all works fine, the shreds can then use the variables. However... when I want to change the code of this public class while I'm developing it, I can't because the class is already declared in the namespace. I have to stop the VM every time, which from miniAudicle is a considerable hassle as it means quitting and then going into task manager and killing the process. Same in Audicle. I'm trying out the command line version and it seems OK but I can't quite figure it out - what's the best way to do this?

Anyone faced and overcome this issue? Am I doing something dumb?

Cheers

Alex
Back to top
View user's profile Send private message
witt0191



Joined: Feb 13, 2008
Posts: 23
Location: UK

PostPosted: Mon Apr 18, 2011 5:18 am    Post subject: Reply with quote  Mark this post and the followings unread

hi,

When you say that you have tried it with the command line are you just doing chuck <file.ck> or chuck --loop.

As chuck --loop is akin to the miniAudicle VM behaviour while the other once starts and stops the VM as the file executes.
Back to top
View user's profile Send private message
alexbarbed



Joined: Apr 09, 2011
Posts: 14
Location: UK

PostPosted: Tue May 10, 2011 4:18 am    Post subject: Reply with quote  Mark this post and the followings unread

I wasn't using --loop... now I am. Thanks!
Back to top
View user's profile Send private message
jordan



Joined: May 16, 2011
Posts: 5
Location: Brooklyn, New York

PostPosted: Mon May 16, 2011 10:07 am    Post subject: Reply with quote  Mark this post and the followings unread

If you're working at the command line, it's easier to write it into the code to handle the launching of new scripts using Machine.add("path_to_your_script.ck").

Let's say you have some shared data being defined in a script - "parent.ck", and that is accessed from a script that will spork a bunch of shreds - "children.ck". I would define a third script, let's call it "run.ck". So it'd look like this:




run.ck:
--------------------------------------------------------------------------------
Machine.add("parent.ck");
Machine.add("children.ck");
--------------------------------------------------------------------------------




parent.ck:
--------------------------------------------------------------------------------
public class MrGenerous {
static int someSharedThing;
}
--------------------------------------------------------------------------------



children.ck:
--------------------------------------------------------------------------------
fun void access_shared() {
// do something with MrGenerous.someSharedThing here
}
spork ~ access_shared();
spork ~ access_shared();
spork ~ access_shared();

// don't forget to keep this shred alive to preserve its decedents.
while(true) {
100::ms => now;
}
--------------------------------------------------------------------------------


then at the command line you can just say "chuck run.ck" (or "chuck run")
Back to top
View user's profile Send private message
alexbarbed



Joined: Apr 09, 2011
Posts: 14
Location: UK

PostPosted: Mon May 16, 2011 3:10 pm    Post subject: Reply with quote  Mark this post and the followings unread

Neat! Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Moderators: Kassen
Page 1 of 1 [5 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » ChucK programming language
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use