As I read through Flow
class defined in Akka Stream code,
I felt type parameter declarations in the following functions a little bit confusing.
def join[I2, O2, Mat2](bidi: Graph[BidiShape[Out, O2, I2, In], Mat2]): Flow[I2, O2, Mat] = joinMat(bidi)(Keep.left)
def joinMat[I2, O2, Mat2, M](bidi: Graph[BidiShape[Out, O2, I2, In], Mat2])(combine: (Mat, Mat2) ⇒ M): Flow[I2, O2, M] = {
What I thought was strange is about type parameter name O2
.
In BidiShape
class definition, the type parameter naming below is adopted.
final case class BidiShape[-In1, +Out1, -In2, +Out2]
Therefore, when we express BidiShape
as a drawing, that would be like this :
+------+
In1 ~>| |~> Out1
| bidi |
Out2 <~| |<~ In2
+------+
But, in join
and joinMat
definitions, type parameter naming seems to not correspond to
that of BidiShape
.
Out1
in BidiShape
is translated into O2
in join
and joinMat
definitions.
As far as my understanding of these two functions, this
Flow is connected to BidiFlow like the following figure.
+---------------------------------+
| Resulting Flow |
| |
| +------+ +------+ |
| | | ~Out(= I1)~> | | ~~> O1
| | flow | | bidi | |
| | | <~In(= O2)~ | | <~~ I2
| +------+ +------+ |
+---------------------------------+
So, I would suggest to change names of type parameter O2
in join
and joinMat
to O1
as declared in BidiShape
.
Of course I understand there are many things I may misunderstand about Akka code,
So I would like to hear opinions about this suggestion by Akka experts.
If this suggestion seems reasonable, I’m ready to send PR for it.