It seems to me that in a statically typed, object oriented language, there is a striking similarity to wiring diagrams. Wires (objects) of type $X$ go into functions (boxes) of input type $X$. Is the corresponding string calculus that of a symmetric monoidal category?


Edit: it has been suggested that I formulate a more specific question. Here goes: let the programming language have private member variables. At this point you cannot copy arbitrary objects because the data is hidden. I guess you also have to assume that there is no generic copy method for all types. Becasue copying isn't allowed arbitrarily, we might need a monoidal category to handle the semantics. Is this the case?



Monoidal cats and string diagrams for a semantics of object oriented programming languages
No full answer but just some random thoughts on the issue:


Concerning the string diagram calculus: It should be that of a mutlicategory (see David Spivaks paper on the Wiring Operad: <http://arxiv.org/abs/1305.0297>).


Plus I think there's a hidden issue here: Private member variables are only of real concern if the objects are stateful; Otherwise - if they are not observable after object instantiation a.k.a. function call - they can just be considered implementation details. I don't think modelling the wiring between the objects using a multicategory / monoidal category is an approach powerful enough to reason about mutable state. But I guess by adding labels to the diagrams (similar to Petri nets) and let them vary over time this could be fixed. (Again, consult David Spivak for an idea on how to model such a labeling: <http://math.mit.edu/~dspivak/informatics/olog.pdf>)


EDIT: Concerning the labeling - a rough sketch: A typing of the diagrams at hand shoult propably be used as input to some sort of grothendieck construction and a labeling should then be a lift of the base diagram into the respective fibration. Including Maybe/Option/Exception Types should allow for partial diagrams while the program is still 'booting'.


