> Bacteria continue to metabolize after sending chemical signals to their brethren after all!
I absolutely love the metabolism metaphor but it doesn't map directly to computer programs as we write them today.
Metabolic pathways form an intricate system:
https://upload.wikimedia.org/wikipedia/commons/a/a8/Human_Me...
Glycolysis, for example: starting from glucose at the top, we can follow its decomposition in the cell all the way to the mitochondrion.
This is similar to Unix pipelines. However, on Unix we must manually construct the pipeline:
find ~/notes | grep TODO
In a metabolism-like system, the mere existence of these programs would be enough to provoke computation. I'd write "~/notes" somewhere and the find and grep programs would somehow know the data was meant for them and automatically execute themselves.Enzymes are analogous to programs running in parallel. They are completely independent and don't interface directly with each other. They implement a process just like functions do. However, they don't explicitly call upon each other to perform a task.
Substrates and products are analogous to data of highly specific types. Catalysis occurs when substrate and enzyme come close enough to interact. The enzyme takes the substrate from a shared environment and releases the product into the same environment where the process repeats with other enzymes. This environment is most commonly the cytoplasm.
Enzymes determine whether their substrates are compatible by their chemical structure. This points towards structural typing. When glucokinase phosphorylates glucose, it becomes a different substrate: glucose 6-phosphate. Likewise, when a function adds a property to an object, it's structure changes and so does its type.
For example, let's take the following functions:
f : A -> B
g : B -> C
h : C -> D
In a metabolic system, there is no need to explicitly write code like: a = A(input())
h(g(f(a)))
Rather, they would immediately consume values of type A when they enter the system and the output would be a value of type D in the environment. The computer would fully metabolize data whenever it becomes available and go idle afterwards. As if the programming language's virtual machine was constantly processing all objects in the system: for object in objects:
for function in functions:
if function.argument.type == object.type:
result = function(object)
objects.add(result)
objects.remove(object)
break
It would be like polymerase chain reaction: throw DNA polymerase, nucleotides, some ions, the target DNA and its matching primers in a reaction tube, heat it up in a thermal cycler and the copying will begin happen because all the pieces are in place.