bergie/noflo — pull request #42 by kenhkan (2012-08-27 22:44:13+00:00)
Title: Compile subgraphs into parent graphs before executing

My other two outstanding pull requests (#40, #41) deal with subgraphs. They have always felt like unsafe patches to me, but I think I finally got a cleaner solution to it, but it does change the API so I really look forward to some input.

I figured that the problems that I've been encountering is due to the fact that subgraphs are initialized *after* the parent graph is set up and ready to send IPs. This solution involves pre-compiling the sub-graphs directly into the parent graph (and do so recursively) before executing the graph.

So, in this completely trivial example:
```
# abc.fbp
'group' -> GROUP Group(Group)
Merge(Merge) OUT -> IN Group() OUT -> IN Split(Split)
```
```
# def.fbp
'abc.fbp' -> GRAPH A(Graph)
Merge(Merge) OUT -> IN A.Merge()
```
```
# main.fbp
'def.fbp' -> GRAPH A(Graph)
'initial' -> IN Merge(Merge) OUT -> IN A.Merge()
A.A.Split() OUT -> IN Output(Output)
```
This would yield (invisible to the programmer):
```
'group' -> GROUP A.A.Group(Group)
A.A.Merge(Merge) OUT -> IN A.A.Group() OUT -> IN A.A.Split(Split)

A.Merge(Merge) OUT -> IN A.A.Merge()

'initial' -> IN Merge(Merge) OUT -> IN A.Merge()
A.A.Split() OUT -> IN Output(Output)
```

What this does is eliminate all the testing and waiting for a ready-state. The namespace should also avoid any name clash since FBP doesn't have dots in component names.

The downside of this approach is the change at the API level.

Would this be a long-term solution to the problem?