Hi,

I've been experimenting with merging multiple PartialFlowGraphs into a 
single FlowGraph, but have run into some difficulty.

In the short example attached, I attempt to join two compatible graphs, 
where graphA.OUT is an UndefinedSink[Int], and graphB.IN is an 
UndefinedSource[Int].

I thought that an appropriate way to join these two is with a NoOp Flow:

FlowGraphBuilder.connect(sink, Flow.apply, source)

However, it seems as though this is not type-safe. I can insert an 
arbitrary flow, or mix the types of sink and source, and the compiler does 
not complain (although the graph does fail with a ClassCastException at 
runtime).

The compiler does complain if I explicitly state the types when calling 
*connect*.

FlowGraphbuilder.connect(outA, Flow.apply, inB) // compiles, runs
FlowGraphbuilder.connect[Int, Int](outA, Flow.apply, inB) //compiles, runs

FlowGraphbuilder.connect(outA, Flow.apply[Double].map(x=>x*2), inB) //compiles, 
does not run
FlowGraphbuilder.connect[Int, Int](outA, Flow.apply[Double].map(x=>x*2), inB
) //does not compile

In my larger real-world example, I actually changed the type of graphB.IN, 
and it didn't fail until runtime.

I like the idea of being able to compose a larger graph from compatible 
chunks, but I wonder if I have chosen the wrong way to go about it?

Thanks in advance,

Stu











-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Attachment: FlowGraphBuilderSpec.scala
Description: Binary data

Reply via email to