On Thursday, November 13, 2014 12:49:40 PM UTC, Martynas Mickevičius wrote
>
> Hi Stu,
>
> it seems that FlowGraphbuilder.connect needs to be refactored to two 
> parameter lists so Scala is able to infer both type parameters before using 
> them.
>
> I have experimented with that a bit here 
> <https://github.com/2m/scala-sandbox/blob/296410007df8eb1bfa78e026a8295ab46401c307/src/test/scala/TypeParameterInference.scala>
>  which 
> addresses both of your concerns. Could you register an issue on akka issue 
> tracker?
>

That looks good, thanks. I've raised 
https://github.com/akka/akka/issues/16311 as requested.


> On Tue, Nov 11, 2014 at 12:08 AM, <[email protected] <javascript:>> 
> wrote:
>
>> 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] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Martynas Mickevičius
> Typesafe <http://typesafe.com/> – Reactive 
> <http://www.reactivemanifesto.org/> Apps on the JVM
>  

-- 
>>>>>>>>>>      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.

Reply via email to