Services


A service is a template for a process

A process is asynchronous and can be signaled or send and receive messages

Creating

#stack_srv : Service[] {
    @stack : Array[I64] {}
    method #push : Fn[I64 $v] { @stack push $v }
    method #pop : Fn[] { pop @stack }
    method #top : Fn[] { @stack(-1) }
    method #clear : Fn[] { @stack : Array[I64] {} }
    method #set : Fn[Buffer[Array[I64]] #buf] { @stack : render #buf }
    method #get : Fn[] { buffer @stack }
    method #swap : Fn[I64 $x] { $v : @stack(-1); @stack(-1) : $x; $v }
}
%stack_proc : #stack_srv()

Sending Messages

Values

%tack_proc.#push(1)

Buffers

%tack_proc.#set(buffer Array[I64] { 1; 2; 3 }

Signaling

%stack_proc.#clear()

Receiving Messages

Values

$top : %stack_proc.#top()

Buffers

@stack : render %stack_proc.#get()

Sending And Receiving

$top : %stack_proc.#swap(6)