Closed btittelbach closed 10 years ago
Also added code for n-to-1 connections, since they are the even more common case in go and of course: tests.
This is a major addition. It has to be properly documented though, so there are no surprises in how multiple connections behave. For example, 1-to-N connections in NoFlo use "copy reference and send it to all receivers" semantics. I like this pseudo-random choice more, because it follows the FBP "single owner of the same packet at any time" rule.
Good job, @btittelbach!
Hi,
Playing around with goflow, I discovered the example program would crash if I would connect two instances of Printer to Greeter. While that might seem nonsensical from a FBP viewpoint, it DOES make perfect sense from the language's point of view. In Go you are supposed to be able to have multiple goroutines receive on the same channel. Go will pseudo-randomly choose a ready goroutine to receive the next message. At the very least it avoids crashes.
Modified example program: