Skip to content

Instantly share code, notes, and snippets.

@JobLeonard
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JobLeonard/ca947302bae5ee12e940 to your computer and use it in GitHub Desktop.
Save JobLeonard/ca947302bae5ee12e940 to your computer and use it in GitHub Desktop.
Céu: organisms within organisms
class HelloWorld with
var int id;
do
_printf("[%d] Hello world!\n", this.id);
every 1s do
_printf("[%d] Hello world!\n", this.id);
end
end
class HelloMulticellular with
pool HelloWorld[] hs;
var int i;
do
every 1s do
// "this.id = this.i" won't work, obviously.
// Is there a better workaround?
// Design opening for better syntactic sugar?
var int t = this.i;
spawn HelloWorld in this.hs with
this.id = t;
end;
this.i = t + 1;
end
end
loop do
var HelloMulticellular hmc with
this.i = 1;
end;
await 5s;
end
@fsantanna
Copy link

You can use "outer":

    ...
    this.id = outer.id;

(I'll answer your e-mail in the list later...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment