Various points - reading this Group is like drinking from a fire hose!
- I am quite willing to accept Rob Pike's definition of "concurrency", and it certainly seems as though "classical" FBP is "concurrent" by this definition.
- I sort of see how ports are mapped onto parameters, but how would Paul T's input parameters handle array ports? Something like (
in <-
chan[] string) - and it should read 'IP' instead of string... so (
in <-
chan[] IP) ?- In all my FBP implementations, input ports (or input port array elements) correspond 1:1 to input connections - one output port cannot be connected to more than one input channel (unlike NoFlo!)
- yes, array ports allow the array size to be determined at run time - in these same implementations, "openInputArray" constructs "inportArray" at run time, which can then have its length queried by the run code. Typically, array ports allow components to support multiple input or output ports which basically have the same function - and since you have to say in the component attributes (where supported) whether a port is array-type or not, at configuration time I treat IN[0] and IN as essentially the same. If the elements have different functions, I would use different ports and port names.
- this also allows the component to have other ports with different names (either array-type or not) - Collate has CTLFIELDS
- Paul T's Collate goroutine in his Go Collate example seems to be very different in a number of ways from the JavaFBP, C#FBP, JSFBP Collates (JSFBP is missing the logic to insert brackets in the output - my bad!),
- the Collate component should treatsall IN port array elements identically, and the number of elements may range from 1 to indefinite (the 1 case just does bracket insertion), determined at network
configuration time
- Collate assumes all input streams have been sorted - and by the same key values
- the two readers can use the same code - or at least the two readers should generate IPs (information packets) which are acceptable to Collate - I would have preferred to see that in the example
- the general logic seems to be wrong - at a high level, Collate should do the following:
- it starts by receiving an IP from
each input port array element and saving it in an IP array
- initialize a field (call it 'hold') to high values
- repeat following:
- for each input port element,
- do a receive and compare the key against 'hold'
- if key is low, set 'hold' to key, and save port element
number - if key is equal, save port element
number
- output IP saved in IP array [saved number] (adding in bracket logic, based on this key and previous key)
- receive IP from input port array element [saved number], saving it in IP array [saved number]
- keep doing the above - until end of stream on all elements
- a useful side effect is that, if two records have the same key, the one from the lowest numbered array port element goes out (and is refreshed) first
- note also that Collate does not reference a particular element number explicitly
- the code in
https://github.com/jpaulm/javafbp/blob/master/src/main/java/com/jpmorrsn/fbp/components/Collate.java is a bit more complex than needed to illustrate this function, as Collate has to decode a list of control fields, but the key logic is in statements 77-114 . "sendOutput" looks after inserting close and open brackets - as I said above, JSFBP seems to be missing this function - I have raised it as an issue!
- have either of you looked at Vladimir Sibirov's Goflow -
https://github.com/trustmaster/goflow ? Haven't looked into it, but my impression is that it hews closer to NoFlo than "classical" FBP... but I may be wrong! Vladimir, any comments?
Bert, how can you say, "Sadly, I'm not that familiar with array ports either, but I believe
(from what I have read about them) that they offer some sort of ability
to add ports at flow configuration-time."?
a) that's not their purpose, but it wouldn't be too hard to add either kind of port at run-time - we just have to sacrifice the config time checking against component attributes, or have some kind of half-way house...
b) apparently, you have attended all the Toronto meetups and have never read the book... Tsk! ;-)
Finally, I will ask again: why do you all keep trying to implement FBP in various exotic languages, rather than just using JavaFBP or C#FBP (or CppFBP or JSFBP) for real applications and building up a body of knowledge which we can all benefit from? This question does not apply to Paul T or Matt, as I know your reasons for choosing your particular languages!