blob: f869789d77800b368f7b2fd6b786b51f8b2642b7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
|
namespace;
include rt, actor;
typecheck on;
type Operation = int(int);
int handle(Operation operation) { return operation(3); }
fn main() {
actor.Actor<Operation,int>* a = rt.new(actor.Actor<Operation,int>);
a.spawn(handle); let result = 0; a.recv(fn(int n) { result = n; return 0; });
char* text = rt.new(char, 3); text[0] = 'a'; text[1] = 'b'; let offset = 7; float scale = 2.0;
Operation operation = fn:int(int n) { if (scale == 2.0) return n + offset + rt.len_w(text); return -1; };
a.send(operation); a.await(); rt.put_n(result); rt.put_c(10); a.close(); return 0;
}
|