krishna Prasad
krishna Prasad

Reputation: 3812

What does ?~> meaning in the scala programming language?

I met with the below statements in a scala code

val stage = stage1 ?~> stage2 ?~> stage3 ~> stage4

Can anyone please explain the meaning of the ?~> and how these statements will be evaluated.

Upvotes: 0

Views: 119

Answers (1)

Tim
Tim

Reputation: 27356

An infix operation a op b is compiler shorthand for a.op(b). So that code is directly equivalent to

((stage1.?~>(stage2)).?~>(stage3)).~>(stage4)

which is evaluated like this:

val t1 = stage1.?~>(stage2)
val t2 = t1.?~>(stage3)
val result = t2.~>(stage4)

?~> is a method of the object stage1 that returns an object that has a ?~> method that returns an object with a ~> method.

What it actually does depends on what library you are using and the type of the stage objects.

Upvotes: 3

Related Questions