
On Wed, Sep 3, 2008 at 10:28 AM, Phil Endecott <spam_from_boost_dev@chezphil.org> wrote:
David Abrahams wrote:
on Wed Sep 03 2008, "Phil Endecott" <spam_from_boost_dev-AT-chezphil.org> wrote:
[snip]
rng >>= funcA >>= funcB ....
For which library are you suggesting that notation?
That's the notation currently proposed for Dataflow. I would prefer no operator overloading here, but would accept operator|. Stjepan, is there any precedent (other languages etc.) for >>=?
Not that I am aware of. It was inspired by the >> operator use in C++, e.g., in >> out1 >> out2, but I needed an operator that is evaluated right-to-left (I think it had to do with making possible certain expressions that use both branching and chaining). Also, I didn't want to clash with the common extraction semantics of >> when in fact a permanent connection was being created. Now, It could be argued that >> or >>= would be more appropriate for branching, as an expression like "in >> out1 >> out2" typically implies that out1 and out2 are both getting their input from in (rather than out1 serving as a filter). And "|" might be more appropriate for chaining because of the piping analogy that you mentioned. Perhaps the use of the two operators should be switched in the Dataflow library. I am open to that. Since they are just syntactic sugar (they just call the connect function), it could even be possible to provide multiple sets of operators, and let the user choose, but I could also see this as being a source of confusion. Stjepan