0

Here is the method signature example:

someMethod [A <: BaseType : SecondType : ClassTag] trait BaseType {} trait SecondType[A] {} 

ClassTag is scala.reflect.ClassTag

What does ":" means?

Does BaseType influence to SecondType or/and ClassTag parametrization?

For me when I see [A <: BaseType] I understand that I should call someMethod with type parameter that implements/extends trait BaseType, but what other parameters are used for?

3
  • 1
    possible duplicate of What are Scala context and view bounds? Commented Sep 12, 2014 at 5:27
  • There are only examples like (A:a, B,b), not likle (A:a:b:c). Commented Sep 12, 2014 at 5:31
  • 1
    Why are there questions about "what are all the uses of underscore" but not "what are all the uses of colon?" or "dot?" or "dollar?" Commented Sep 12, 2014 at 5:43

1 Answer 1

8

That's probably obvious to someone, but:

scala> trait X[A] ; trait Y[A] scala> def f[A : X : Y] = 42 

yields

 def f[A](implicit evidence$1: X[A], evidence$2: Y[A]) = 42 

under -Xprint:parser. So it wants both X[A] and Y[A].

Sign up to request clarification or add additional context in comments.

1 Comment

I suggest somethink like that, but not sure. Thanks a lot.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.