Below is a diagram of a Component sending itself a message.


Is the above diagram the same as recursion?


With recursion, the loopback returns a value to the caller.

In this diagram, though, C is an asynchronous software component (ASC). It cannot process more messages until it has finished processing the message that it is currently working on.

So, in this case, C will see the message-to-itself only after it has finished processing the first message.

The loopback arrow is like a queue.

C can send itself messages, but the messages get queued up for later processing.

Recursion and Stacks

Recursion implies the use of a stack.

Recursive calls are processed immediately, suspending all work-in-progress.

Asynchronous Software Components

ASC’s never suspend work.

If an ASC produces new messages, those messages are queued up at the receiver(s).


A Dispatcher invokes Components that have messages queued up.

The Components do not get to decide who runs next1.

Components create messages and leav it to the Dispatcher to decide which Component will run next.

Distributed Computing (Internet)

Stacks are meaningless for distributed programming.

A connection between two components can carry messages but it is not a stack in the traditional sense

GPLs2 use stacks.

The internet does not use stacks.

[Nodes on the internet might use GPLs and stacks, but the internet itself does not imply the use of stacks.]


CPS means Continuation Passing Style, a technique that grew out of the use of first-class functions.

Continuations are tuples that contain data + control-flow.

CPS implies that control-flow is “changeable” and that control-flow is encoded in the Continuation.

ASCs, though, have exactly one control-flow. ASCs start running at the top every time. [If the programmer wants to program different control-flows, the programmer uses case statements.]

Control Flow and the Internet

It doesn’t make sense to send Control Flow across the internet.

The best you can do is to send messages.

The receiver reacts to the messages (maybe using a case statement).

CPS includes control flow, hence, CPS is not a basic operation that can be used for distributed computing3.


RPC means Remote Procedure Call.

RPC seems to do a CALL/RETURN over the internet.

This is actually faked out and is implemented by sending messages. This kind of faking-out requires extra code and complexity and latency.

See Also

Table of Contents

  1. Note that with CALL/RETURN, the CALLer gets to determine who runs next, by CALLing a function. 

  2. GPL means General Purpose Language. 

  3. You can continue to cling to the CPS paradigm and fake it out using messages, though.