On Saturday, May 16, 2015 at 3:47:51 PM UTC+2, Oliver Winks wrote: > > If you look at the implementation of Merge you find that it is a generic > type, but without any defined variance: > > classMerge[T] extends Graph > <http://doc.akka.io/api/akka-stream-and-http-experimental/1.0-RC2/akka/stream/Graph.html> > [UniformFanInShape > <http://doc.akka.io/api/akka-stream-and-http-experimental/1.0-RC2/akka/stream/UniformFanInShape.html> > [T, T], Unit <http://www.scala-lang.org/api/2.10.5/index.html#scala.Unit>] > > Is there any reason for this? Would it not make sense to define it as a > covariant type? e.g: > > classMerge[+T] extends Graph > <http://doc.akka.io/api/akka-stream-and-http-experimental/1.0-RC2/akka/stream/Graph.html> > [UniformFanInShape > <http://doc.akka.io/api/akka-stream-and-http-experimental/1.0-RC2/akka/stream/UniformFanInShape.html> > [T, T], Unit <http://www.scala-lang.org/api/2.10.5/index.html#scala.Unit>] >
Merge is both an input and an output element, so invariance is indeed the correct variance configuration. Otherwise you could feed it supertype elements that the output side cannot consume. If you use it during building a graph, you can access its inlets and outlets which have the right variances set so invariance at the `Merge-type itself shouldn't be a constraint. -- >>>>>>>>>> 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.
